* Tasedit: more refactoring

* Tasedit: resizing TAS Editor window
* Tasedit: INPUT_TYPE_1P
* Tasedit: File->New Project
This commit is contained in:
ansstuff 2012-01-12 19:56:17 +00:00
parent 64a4100c54
commit 578c974062
48 changed files with 2005 additions and 1396 deletions

View File

@ -1,4 +1,12 @@
08-jan-2011 - prg - switched advance one frame key from "\" to "`"
12-jan-2012 - AnS - Tasedit: File->New Project, INPUT_TYPE_1P
12-jan-2012 - AnS - Tasedit: resizing TAS Editor window
08-jan-2012 - prg - sdl: switched advance one frame key from "\" to "`"
08-jan-2012 - AnS - changed default mapping of Frame Advance to Tilde
08-jan-2012 - AnS - fixed recording bug where "length" tag appeared in fm2s
08-jan-2012 - AnS - Tasedit: Lua panel; 5 new Lua functions
08-jan-2012 - AnS - Tasedit: refactoring; Config->Silent autosave
04-jan-2012 - AnS - Tasedit: colored marker captions; pale yellow and bright yellow when "Bind Markers" is off/on
27-dec-2011 - AnS - Tasedit: "About" window
27-dec-2011 - AnS - Tasedit: searching Markers with similar Notes ("Similar" and "More" buttons)
26-dec-2011 - AnS - Tasedit: Find Note dialog (Ctrl-F)

View File

@ -211,7 +211,7 @@ void FCEUI_CheatSearchSetCurrentAsOriginal(void);
#define FCEUIOD_MOVIES 6 //.fm2 files
#define FCEUIOD_MEMW 7 //memory watch fiels
#define FCEUIOD_BBOT 8 //basicbot, obsolete
#define FCEUIOD_MACRO 9 //macro files - old tasedit v0.1 paradigm, not implemented, probably obsolete
#define FCEUIOD_MACRO 9 //macro files - old TASEdit v0.1 paradigm, not implemented, probably obsolete
#define FCEUIOD_INPUT 10 //input presets
#define FCEUIOD_LUA 11 //lua scripts
#define FCEUIOD_AVI 12 //default file for avi output
@ -335,7 +335,7 @@ enum EFCEUI
FCEUI_NEXTSAVESTATE,FCEUI_PREVIOUSSAVESTATE,FCEUI_VIEWSLOTS,
FCEUI_STOPMOVIE, FCEUI_RECORDMOVIE, FCEUI_PLAYMOVIE,
FCEUI_OPENGAME, FCEUI_CLOSEGAME,
FCEUI_TASEDIT,
FCEUI_TASEDITOR,
FCEUI_RESET, FCEUI_POWER,FCEUI_PLAYFROMBEGINNING
};

View File

@ -72,6 +72,8 @@ extern int frameSkipAmt;
extern TASEDITOR_CONFIG taseditor_config;
extern char* recent_projects[];
// Hacky fix for taseditor_config.last_author
char* taseditor_config_last_author;
//window positions and sizes:
extern int ChtPosX,ChtPosY;
@ -299,6 +301,8 @@ static CFGSTRUCT fceuconfig[] = {
AC(DesynchAutoFire),
AC(taseditor_config.wndx),
AC(taseditor_config.wndy),
AC(taseditor_config.wndwidth),
AC(taseditor_config.wndheight),
AC(taseditor_config.findnote_wndx),
AC(taseditor_config.findnote_wndy),
AC(taseditor_config.follow_playback),
@ -338,6 +342,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(taseditor_config.savecompact_selection),
AC(taseditor_config.findnote_matchcase),
AC(taseditor_config.findnote_search_up),
ACS(taseditor_config_last_author),
AC(lagCounterDisplay),
AC(oldInputDisplay),
AC(movieSubtitles),
@ -387,6 +392,8 @@ void SaveConfig(const char *filename)
{
ramWatchRecent[x] = rw_recent_files[x];
}
// Hacky fix for taseditor_config.last_author
taseditor_config_last_author = taseditor_config.last_author;
//-----------------------------------
SaveFCEUConfig(filename,fceuconfig);
@ -414,6 +421,11 @@ void LoadConfig(const char *filename)
rw_recent_files[x][0] = 0;
}
}
// Hacky fix for taseditor_config.last_author
if (taseditor_config_last_author)
strncpy(taseditor_config.last_author, taseditor_config_last_author, AUTHOR_MAX_LEN-1);
else
taseditor_config.last_author[0] = 0;
//-----------------------------------
}

View File

@ -1274,7 +1274,7 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
UpdateFourscoreState(hwndDlg);
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
// disable changing fourscore and ports
EnableWindow(GetDlgItem(hwndDlg, CHECK_ENABLE_FOURSCORE), false);
@ -1535,7 +1535,7 @@ int FCEUD_TestCommandState(int c)
// else
// keys_nr=GetKeyboard_nr();
}
else if(c != EMUCMD_SPEED_TURBO && c != EMUCMD_TASEDIT_REWIND) // TODO: this should be made more general by detecting if the command has an "off" function
else if(c != EMUCMD_SPEED_TURBO && c != EMUCMD_TASEDITOR_REWIND) // TODO: this should be made more general by detecting if the command has an "off" function
{
keys=GetKeyboard_jd();
keys_nr=GetKeyboard_nr();

View File

@ -19,7 +19,7 @@ void UpdateJoysticks(void);
int DTestButtonJoy(ButtConfig *bc);
#define JOYBACKACCESS_OLDSTYLE 1
#define JOYBACKACCESS_TASEDIT 2
#define JOYBACKACCESS_TASEDITOR 2
void JoystickSetBackgroundAccessBit(int bit);
void JoystickClearBackgroundAccessBit(int bit);
void JoystickSetBackgroundAccess(bool on);

View File

@ -5,7 +5,7 @@ unsigned int *GetKeyboard(void);
unsigned int *GetKeyboard_nr(void);
unsigned int *GetKeyboard_jd(void);
#define KEYBACKACCESS_OLDSTYLE 1
#define KEYBACKACCESS_TASEDIT 2
#define KEYBACKACCESS_TASEDITOR 2
void KeyboardSetBackgroundAccessBit(int bit);
void KeyboardClearBackgroundAccessBit(int bit);
void KeyboardSetBackgroundAccess(bool on);

View File

@ -417,8 +417,8 @@ void DoFCEUExit()
#ifdef WIN32
//If user was asked to save changes in TAS Editor and chose cancel, don't close FCEUX
extern bool ExitTasEdit();
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT) && !ExitTasEdit()) return;
extern bool ExitTasEditor();
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR) && !ExitTasEditor()) return;
#endif
if (CloseMemoryWatch() && AskSave()) //If user was asked to save changes in the memory watch dialog or ram watch, and chose cancel, don't close FCEUX!
@ -869,8 +869,8 @@ void _updateWindow()
//UpdateLogWindow(); //adelikat: Moved to FCEUI_Emulate
UpdateMemWatch();
NTViewDoBlit(0);
extern void UpdateTasEdit();
UpdateTasEdit();
extern void UpdateTasEditor();
UpdateTasEditor();
}
void win_debuggerLoop()

View File

@ -73,7 +73,7 @@ static struct
{ EMUCMD_RELOAD, SCAN_F1 | CMD_KEY_CTRL , },
{ EMUCMD_MISC_UNDOREDOSAVESTATE, SCAN_Z | CMD_KEY_CTRL, },
{ EMUCMD_MISC_TOGGLEFULLSCREEN, SCAN_ENTER | CMD_KEY_ALT, },
{ EMUCMD_TASEDIT_REWIND, SCAN_ESCAPE, },
{ EMUCMD_TASEDITOR_REWIND, SCAN_ESCAPE, },
{ EMUCMD_RERECORD_DISPLAY_TOGGLE, SCAN_M, },
};

View File

@ -164,7 +164,7 @@ BEGIN
MENUITEM "RAM Search...", ID_RAM_SEARCH
MENUITEM "RAM Watch...", ID_RAM_WATCH
MENUITEM "&Memory Watch...", MENU_MEMORY_WATCH
MENUITEM "&TAS Editor...", MENU_TASEDIT, INACTIVE
MENUITEM "&TAS Editor...", MENU_TASEDITOR, INACTIVE
MENUITEM "Convert &FCM...", MENU_CONVERT_MOVIE
MENUITEM SEPARATOR
POPUP "Autofire &Pattern"
@ -217,20 +217,21 @@ BEGIN
END
END
TASEDITMENU MENU
TASEDITORMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New", ID_FILE_NEW
MENUITEM "&Open", ID_FILE_OPENPROJECT
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVEPROJECT
MENUITEM "S&ave As", ID_FILE_SAVEPROJECTAS
MENUITEM "Save &Compact", ID_FILE_SAVECOMPACT
MENUITEM "&Recent", ID_TASEDIT_FILE_RECENT
MENUITEM "&Recent", ID_FILE_RECENT
MENUITEM SEPARATOR
MENUITEM "&Import", ID_FILE_IMPORT
MENUITEM "&Export to FM2", ID_FILE_EXPORTFM2
MENUITEM SEPARATOR
MENUITEM "&Close\tAlt+F4", ID_TASEDIT_FILE_CLOSE
MENUITEM "&Close\tAlt+F4", ID_FILE_CLOSE
END
POPUP "&Edit"
BEGIN
@ -243,13 +244,13 @@ BEGIN
MENUITEM "Select between &Markers\tCtrl+A", ID_EDIT_SELECTMIDMARKERS
MENUITEM "Reselect Clipboard\tCtrl+B", ID_EDIT_RESELECTCLIPBOARD
MENUITEM SEPARATOR
MENUITEM "&Copy\tCtrl+C", ID_TASEDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_TASEDIT_PASTE
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
MENUITEM "PasteInsert\tShift+V", ID_EDIT_PASTEINSERT
MENUITEM "Cu&t\tCtrl+X", ID_TASEDIT_CUT
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
MENUITEM SEPARATOR
MENUITEM "C&lear\tDel", ID_EDIT_CLEAR
MENUITEM "&Delete\tCtrl+Del", ID_TASEDIT_DELETE
MENUITEM "&Delete\tCtrl+Del", ID_EDIT_DELETE
MENUITEM "Cl&one\tCtrl+Ins", ID_EDIT_CLONEFRAMES
MENUITEM "&Insert\tShift+Ins", ID_EDIT_INSERTFRAMES
MENUITEM "Insert # of Frames\tIns", ID_EDIT_INSERT
@ -295,7 +296,7 @@ BEGIN
END
POPUP "&Help"
BEGIN
MENUITEM "&TAS Editor Help", ID_HELP_TASEDITHELP
MENUITEM "&TAS Editor Help", ID_HELP_TASEDITORHELP
MENUITEM SEPARATOR
MENUITEM "&About", ID_HELP_ABOUT
END
@ -371,7 +372,7 @@ BEGIN
END
END
TASEDITCONTEXTMENUS MENU
TASEDITORCONTEXTMENUS MENU
BEGIN
POPUP "Stray"
BEGIN
@ -1380,58 +1381,58 @@ BEGIN
EDITTEXT IDC_LABEL_NEWPPUUSED,76,166,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
END
TASEDIT DIALOGEX 0, 0, 438, 396
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
TASEDITOR DIALOGEX 0, 0, 323, 351
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "TAS Editor"
MENU TASEDITMENU
MENU TASEDITORMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_PROGRESS_BUTTON,"Button",BS_OWNERDRAW,314,37,116,12
CONTROL "",IDC_BRANCHES_BUTTON,"Button",BS_OWNERDRAW,320,168,104,11
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER,6,15,299,362
GROUPBOX " Playback ",IDC_STATIC,310,1,123,62,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Recorder ",IDC_STATIC,310,64,123,46,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Splicer ",IDC_STATIC,310,111,123,30,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Bookmarks ",IDC_BOOKMARKS_BOX,310,170,123,103,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Lua ",IDC_STATIC,310,142,123,26,BS_CENTER,WS_EX_RIGHT
GROUPBOX " History ",IDC_STATIC,310,273,123,99,BS_CENTER,WS_EX_RIGHT
PUSHBUTTON "<<",TASEDIT_REWIND_FULL,314,10,23,14,NOT WS_TABSTOP
PUSHBUTTON "<",TASEDIT_REWIND,337,10,23,14,NOT WS_TABSTOP
PUSHBUTTON "||",TASEDIT_PLAYSTOP,360,10,23,14,NOT WS_TABSTOP
PUSHBUTTON ">",TASEDIT_FORWARD,383,10,23,14,NOT WS_TABSTOP
PUSHBUTTON ">>",TASEDIT_FORWARD_FULL,406,10,23,14,NOT WS_TABSTOP
CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,314,40,115,6
CONTROL " Follow cursor",CHECK_FOLLOW_CURSOR,"Button",BS_AUTOCHECKBOX,316,26,56,12
CONTROL "",IDC_PROGRESS_BUTTON,"Button",BS_OWNERDRAW,199,36,116,12
CONTROL "",IDC_BRANCHES_BUTTON,"Button",BS_OWNERDRAW,206,167,104,11
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSORTHEADER | WS_BORDER,5,13,186,320
GROUPBOX " Playback ",IDC_PLAYBACK_BOX,196,0,123,62,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Recorder ",IDC_RECORDER_BOX,196,63,123,46,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Splicer ",IDC_SPLICER_BOX,196,110,123,30,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Lua ",IDC_LUA_BOX,196,141,123,26,BS_CENTER,WS_EX_RIGHT
GROUPBOX " Bookmarks ",IDC_BOOKMARKS_BOX,196,169,123,102,BS_CENTER,WS_EX_RIGHT
GROUPBOX " History ",IDC_HISTORY_BOX,196,272,123,56,BS_CENTER,WS_EX_RIGHT
PUSHBUTTON "<<",TASEDITOR_REWIND_FULL,200,9,23,14,NOT WS_TABSTOP
PUSHBUTTON "<",TASEDITOR_REWIND,223,9,23,14,NOT WS_TABSTOP
PUSHBUTTON "||",TASEDITOR_PLAYSTOP,246,9,23,14,NOT WS_TABSTOP
PUSHBUTTON ">",TASEDITOR_FORWARD,269,9,23,14,NOT WS_TABSTOP
PUSHBUTTON ">>",TASEDITOR_FORWARD_FULL,292,9,23,14,NOT WS_TABSTOP
CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,200,39,115,6
CONTROL " Follow cursor",CHECK_FOLLOW_CURSOR,"Button",BS_AUTOCHECKBOX,202,25,56,12
CONTROL " Auto-restore last position",CHECK_AUTORESTORE_PLAYBACK,
"Button",BS_AUTOCHECKBOX,316,49,105,12
CONTROL "",IDC_BOOKMARKSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | NOT WS_VISIBLE | WS_BORDER,315,179,113,89
CONTROL "",IDC_HISTORYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER,315,283,113,85
CONTROL " All",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,316,85,27,10
CONTROL " 1P",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,372,85,25,10
CONTROL " 2P",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,402,85,24,10
CONTROL " 3P",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,372,97,25,10
CONTROL " 4P",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,402,97,24,10
CONTROL " Superimpose",IDC_SUPERIMPOSE,"Button",BS_AUTO3STATE,372,73,55,10
PUSHBUTTON "<<",TASEDIT_PREV_MARKER,315,376,23,14,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
CONTROL "",IDC_JUMP_PLAYBACK_BUTTON,"Button",BS_OWNERDRAW,5,1,59,13
EDITTEXT IDC_PLAYBACK_MARKER_EDIT,65,1,240,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
RTEXT "Marker 0",IDC_PLAYBACK_MARKER,4,3,58,10,0,WS_EX_RIGHT
CONTROL "",IDC_JUMP_SELECTION_BUTTON,"Button",BS_OWNERDRAW,5,377,59,13
EDITTEXT IDC_SELECTION_MARKER_EDIT,65,377,240,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
RTEXT "Marker 99999",IDC_SELECTION_MARKER,4,379,58,10,0,WS_EX_RIGHT
CONTROL "",IDC_BRANCHES_BITMAP,"Static",SS_OWNERDRAW | SS_NOTIFY | SS_REALSIZEIMAGE | NOT WS_VISIBLE,315,179,113,89
CONTROL " Turbo seek",CHECK_TURBO_SEEK,"Button",BS_AUTOCHECKBOX,379,26,50,12
LTEXT "Selection: 0 rows, 16 columns",IDC_TEXT_SELECTION,316,119,114,10
LTEXT "Clipboard: 0 rows, 16 columns",IDC_TEXT_CLIPBOARD,315,129,114,10
CONTROL " Recording",IDC_RECORDING,"Button",BS_AUTO3STATE,316,73,49,10
PUSHBUTTON "Run function",TASEDIT_RUN_MANUAL,315,151,54,14,NOT WS_TABSTOP
CONTROL "Auto function",IDC_RUN_AUTO,"Button",BS_AUTO3STATE,375,153,55,10
"Button",BS_AUTOCHECKBOX,202,48,105,12
CONTROL "",IDC_BOOKMARKSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | NOT WS_VISIBLE | WS_BORDER,201,178,113,89
CONTROL "",IDC_HISTORYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER,201,282,113,42
CONTROL " All",IDC_RADIO_ALL,"Button",BS_AUTORADIOBUTTON,202,84,27,10
CONTROL " 1P",IDC_RADIO_1P,"Button",BS_AUTORADIOBUTTON,258,84,25,10
CONTROL " 2P",IDC_RADIO_2P,"Button",BS_AUTORADIOBUTTON,288,84,24,10
CONTROL " 3P",IDC_RADIO_3P,"Button",BS_AUTORADIOBUTTON,258,96,25,10
CONTROL " 4P",IDC_RADIO_4P,"Button",BS_AUTORADIOBUTTON,288,96,24,10
CONTROL " Superimpose",IDC_SUPERIMPOSE,"Button",BS_AUTO3STATE,258,72,55,10
PUSHBUTTON "<<",TASEDITOR_PREV_MARKER,201,332,23,14,NOT WS_TABSTOP
PUSHBUTTON "Similar",TASEDITOR_FIND_BEST_SIMILAR_MARKER,224,332,34,14,NOT WS_TABSTOP
PUSHBUTTON "More",TASEDITOR_FIND_NEXT_SIMILAR_MARKER,258,332,34,14,NOT WS_TABSTOP
PUSHBUTTON ">>",TASEDITOR_NEXT_MARKER,291,332,23,14,NOT WS_TABSTOP
CONTROL "",IDC_JUMP_PLAYBACK_BUTTON,"Button",BS_OWNERDRAW,4,0,59,13
EDITTEXT IDC_PLAYBACK_MARKER_EDIT,64,0,127,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
RTEXT "Marker 0",IDC_PLAYBACK_MARKER,3,2,58,10,0,WS_EX_RIGHT
CONTROL "",IDC_JUMP_SELECTION_BUTTON,"Button",BS_OWNERDRAW,4,333,59,13
EDITTEXT IDC_SELECTION_MARKER_EDIT,64,333,127,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
RTEXT "Marker 99999",IDC_SELECTION_MARKER,3,335,58,10,0,WS_EX_RIGHT
CONTROL "",IDC_BRANCHES_BITMAP,"Static",SS_OWNERDRAW | SS_NOTIFY | SS_REALSIZEIMAGE | NOT WS_VISIBLE,201,178,113,89
CONTROL " Turbo seek",CHECK_TURBO_SEEK,"Button",BS_AUTOCHECKBOX,265,25,50,12
LTEXT "Selection: 0 rows, 16 columns",IDC_TEXT_SELECTION,203,118,112,10
LTEXT "Clipboard: 0 rows, 16 columns",IDC_TEXT_CLIPBOARD,202,128,114,10
CONTROL " Recording",IDC_RECORDING,"Button",BS_AUTO3STATE,202,72,49,10
PUSHBUTTON "Run function",TASEDITOR_RUN_MANUAL,201,150,54,14,WS_DISABLED | NOT WS_TABSTOP
CONTROL "Auto function",IDC_RUN_AUTO,"Button",BS_AUTO3STATE,260,152,55,10
END
IDD_TASEDIT_ABOUT DIALOGEX 0, 0, 208, 70
IDD_TASEDITOR_ABOUT DIALOGEX 0, 0, 208, 70
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -1445,7 +1446,7 @@ BEGIN
LTEXT "made by zeromus & adelikat",IDC_STATIC,107,31,96,9,SS_NOPREFIX
END
IDD_TASEDIT_EXPORT DIALOGEX 0, 0, 158, 86
IDD_TASEDITOR_EXPORT DIALOGEX 0, 0, 158, 86
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Export to FM2"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -1459,7 +1460,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,141,10
END
IDD_TASEDIT_FINDNOTE DIALOGEX 0, 0, 228, 49
IDD_TASEDITOR_FINDNOTE DIALOGEX 0, 0, 228, 49
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Find Note"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -1473,7 +1474,7 @@ BEGIN
CONTROL " Down",IDC_RADIO_DOWN,"Button",BS_AUTORADIOBUTTON,125,30,32,10
END
IDD_TASEDIT_SAVECOMPACT DIALOGEX 0, 0, 122, 134
IDD_TASEDITOR_SAVECOMPACT DIALOGEX 0, 0, 122, 134
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -1967,24 +1968,23 @@ BEGIN
BOTTOMMARGIN, 198
END
"TASEDIT", DIALOG
BEGIN
RIGHTMARGIN, 433
END
IDD_TASEDIT_ABOUT, DIALOG
"TASEDITOR", DIALOG
BEGIN
END
IDD_TASEDIT_EXPORT, DIALOG
IDD_TASEDITOR_ABOUT, DIALOG
BEGIN
END
IDD_TASEDIT_FINDNOTE, DIALOG
IDD_TASEDITOR_EXPORT, DIALOG
BEGIN
END
IDD_TASEDIT_SAVECOMPACT, DIALOG
IDD_TASEDITOR_FINDNOTE, DIALOG
BEGIN
END
IDD_TASEDITOR_SAVECOMPACT, DIALOG
BEGIN
END
@ -2059,6 +2059,54 @@ END
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Ðóññêèé (Ðîññèÿ) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_TASEDITOR_NEWPROJECT DIALOGEX 0, 0, 171, 100
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create New Project"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,80,50,14
PUSHBUTTON "Cancel",IDCANCEL,114,80,50,14
CONTROL " Copy current input",IDC_COPY_INPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,14,75,10
CONTROL " 1 player",IDC_RADIO_1PLAYER,"Button",BS_AUTORADIOBUTTON,16,14,45,10
CONTROL " 2 players",IDC_RADIO_2PLAYERS,"Button",BS_AUTORADIOBUTTON,16,27,45,10
CONTROL " Fourscore",IDC_RADIO_FOURSCORE,"Button",BS_AUTORADIOBUTTON,16,40,45,10
CONTROL " Copy current markers",IDC_COPY_MARKERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,27,83,10
GROUPBOX "Input type",IDC_STATIC,5,3,67,52,BS_CENTER
EDITTEXT IDC_EDIT_AUTHOR,36,61,127,13,ES_AUTOHSCROLL
LTEXT "Author:",IDC_STATIC,8,63,26,9
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_TASEDITOR_NEWPROJECT, DIALOG
BEGIN
END
END
#endif // APSTUDIO_INVOKED
#endif // Ðóññêèé (Ðîññèÿ) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Àíãëèéñêèé (ÑØÀ) resources
@ -2137,7 +2185,6 @@ BEGIN
VK_DELETE, ACCEL_CTRL_DELETE, VIRTKEY, CONTROL, NOINVERT
"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

View File

@ -180,12 +180,11 @@
#define IDB_BITMAP18 181
#define IDB_BITMAP19 182
#define IDB_BRANCH_SPRITESHEET 184
#define IDD_TASEDIT_EXPORT 185
#define IDD_TASEDIT_SAVECOMPACT 186
#define IDD_TASEDIT_BRANCH_NOTE 188
#define IDD_TASEDITOR_SAVECOMPACT 195
#define IDD_TASEDITOR_EXPORT 196
#define IDI_ICON3 197
#define IDD_TASEDIT_FINDNOTE 198
#define IDD_TASEDIT_ABOUT 199
#define IDD_TASEDITOR_FINDNOTE 198
#define IDD_TASEDITOR_ABOUT 199
#define MENU_RESET 200
#define BUTTON_ROMS 200
#define TXT_PAD1 200
@ -221,6 +220,7 @@
#define IDC_DEBUGGER_FLAG_U 202
#define IDC_ADDBP_CONDITION 202
#define IDC_ASSEMBLER_SAVE 202
#define IDD_TASEDITOR_NEWPROJECT 202
#define MENU_SWITCH_DISK 203
#define IDC_NETMOO_NICK 203
#define IDC_CHEAT_BOX_POSSIBILITIES 203
@ -398,49 +398,51 @@
#define IDC_BUTTON_METADATA 1132
#define IDC_HACKYEXPORT 1133
#define IDC_BUTTON1 1133
#define TASEDIT_REWIND 1133
#define MEMW_EXPANDCOLLAPSE 1133
#define IDC_SOUND_RESTOREDEFAULTVOL 1133
#define TASEDITOR_REWIND 1133
#define IDC_BUTTON2 1134
#define TASEDIT_FORWARD 1134
#define TASEDITOR_FORWARD 1134
#define IDC_BUTTON3 1135
#define TASEDIT_REWIND_FULL 1135
#define TASEDITOR_REWIND_FULL 1135
#define IDC_BUTTON4 1136
#define TASEDIT_FORWARD_FULL 1136
#define TASEDIT_REWIND2 1137
#define TASEDIT_PLAYSTOP 1137
#define TASEDITOR_FORWARD_FULL 1136
#define TASEDITOR_PLAYSTOP 1137
#define IDC_RADIO1 1138
#define IDC_RADIO_UP 1138
#define IDC_RADIO2 1139
#define IDC_RADIO_ALL 1139
#define IDC_RADIO3 1140
#define IDC_RADIO_1P 1140
#define IDC_RADIO4 1141
#define IDC_RADIO_2P 1141
#define MEMW_EDIT00FORMULA 1142
#define IDC_RADIO5 1142
#define IDC_RADIO_3P 1142
#define MEMW_EDIT01FORMULA 1143
#define IDC_RADIO6 1143
#define IDC_RADIO_4P 1143
#define IDC_PROGRESS_BUTTON 1144
#define MEMW_EDIT02FORMULA 1144
#define IDC_BUTTON7 1145
#define MEMW_EDIT03FORMULA 1145
#define TASEDIT_PREV_MARKER 1145
#define TASEDITOR_PREV_MARKER 1145
#define IDC_BUTTON8 1146
#define TASEDIT_FIND_BEST_MARKER 1146
#define TASEDIT_FIND_BEST_SIMILAR_MARKER 1146
#define TASEDITOR_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_SIMILAR_MARKER 1148
#define TASEDITOR_FIND_NEXT_SIMILAR_MARKER 1148
#define IDC_HISTORYLIST 1149
#define IDC_BOOKMARKSLIST 1150
#define TASEDIT_NEXT_MARKER 1151
#define TASEDITOR_NEXT_MARKER 1151
#define IDC_BRANCHES_BUTTON 1152
#define IDC_JUMP_PLAYBACK_BUTTON 1153
#define IDC_EDIT2 1154
#define IDC_PLAYBACK_MARKER_EDIT 1154
#define IDC_JUMP_SELECTION_BUTTON 1155
#define TASEDIT_PREV_MARKER2 1156
#define TASEDIT_RUN_MANUAL 1156
#define TASEDITOR_RUN_MANUAL 1156
#define CHECK_SOUND_MUTETURBO 1179
#define IDC_EDIT_AUTHOR 1180
#define MEMW_STATIC 1181
@ -480,11 +482,13 @@
#define IDC_CHECK_BINARY 1203
#define IDC_NOTES_TO_SUBTITLES 1203
#define IDC_MATCH_CASE 1203
#define IDC_COPY_INPUT 1203
#define IDC_VOLUMEGROUP 1204
#define IDC_OMITBLANK 1204
#define IDC_CHECK3 1204
#define IDC_CHECK_MARKERS 1204
#define IDC_RECORDING 1204
#define IDC_COPY_MARKERS 1204
#define IDC_RAMLIST 1205
#define IDC_CHECK4 1205
#define IDC_CHECK_BOOKMARKS 1205
@ -575,6 +579,11 @@
#define IDC_NOTE_TOOLTIP_EDIT 1272
#define IDC_SELECTION_MARKER2 1272
#define IDC_RADIO_DOWN 1273
#define IDC_PLAYBACK_BOX 1275
#define IDC_RECORDER_BOX 1276
#define IDC_SPLICER_BOX 1277
#define IDC_LUA_BOX 1278
#define IDC_HISTORY_BOX 1279
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
@ -690,13 +699,6 @@
#define ID_FILE_SAVEPROJECTAS 40182
#define ID_FILE_EXPORTFM2 40183
#define ACCEL_CTRL_X 40184
#define ID_TASEDIT_CUT 40188
#define ID_TASEDIT_COPY 40189
#define ID_TASEDIT_COPYTONEW 40190
#define ID_TASEDIT_PASTE 40191
#define ID_TASEDIT_DELETE 40192
#define ID_TASEDIT_FILE_CLOSE 40193
#define ID_TASEDIT_PASTETONEW 40194
#define ACCEL_CTRL_V 40195
#define ACCEL_CTRL_SHIFT_V 40196
#define ACCEL_CTRL_DELETE 40197
@ -851,8 +853,6 @@
#define FCEUX_CONTEXT_LOADLASTMOVIE 40356
#define ID_GAME_SAVEMOVIEAS 40357
#define FCEUX_CONTEXT_SAVEMOVIEAS 40358
#define ID_FILE_RECENT40359 40359
#define ID_TASEDIT_FILE_RECENT 40360
#define ID_OPTIONS_BINDTOMAINWINDOW 40361
#define ID_CONFIG_PPU 40362
#define ID_PPU_NEWPPU 40363
@ -970,6 +970,13 @@
#define ID_CONFIG_REAPPEARINGFINDNOTEDIALOG 40514
#define ID_VIEW_FINDNOTE 40515
#define ID_CONFIG_SILENTAUTOSAVE 40516
#define ID_FILE_CLOSE 40517
#define ID_EDIT_PASTE 40520
#define ID_EDIT_COPY 40521
#define ID_EDIT_CUT 40522
#define ID_HELP_TASEDITORHELP 40523
#define MENU_TASEDITOR 40524
#define ID_FILE_NEW 40525
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -978,9 +985,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 40517
#define _APS_NEXT_CONTROL_VALUE 1275
#define _APS_NEXT_RESOURCE_VALUE 203
#define _APS_NEXT_COMMAND_VALUE 40526
#define _APS_NEXT_CONTROL_VALUE 1280
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -1,9 +1,12 @@
//Specification file for Bookmark class
#define FLASH_PHASE_MAX 11
#define FLASH_TYPE_SET 0
#define FLASH_TYPE_JUMP 1
#define FLASH_TYPE_UNLEASH 2
enum
{
FLASH_TYPE_SET = 0,
FLASH_TYPE_JUMP = 1,
FLASH_TYPE_UNLEASH = 2,
};
#define SCREENSHOT_WIDTH 256
#define SCREENSHOT_HEIGHT 240

View File

@ -89,11 +89,6 @@ void BOOKMARKS::init()
BranchCurrY.resize(TOTAL_BOOKMARKS+1);
reset();
// init bookmarks
bookmarks_array.resize(TOTAL_BOOKMARKS);
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
bookmarks_array[i].init();
ListView_SetItemCountEx(hwndBookmarksList, TOTAL_BOOKMARKS, LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL);
// find rows top/height (for mouseover hittest calculations)
@ -130,34 +125,6 @@ void BOOKMARKS::init()
next_animation_time = 0;
update();
}
void BOOKMARKS::reset()
{
for (int i = TOTAL_BOOKMARKS; i >= 0; i--)
{
BranchX[i] = BranchPrevX[i] = BranchCurrX[i] = EMPTY_BRANCHES_X;
BranchY[i] = BranchPrevY[i] = BranchCurrY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
CursorX = CursorPrevX = CloudX = CloudPrevX = BRANCHES_CLOUD_X;
CursorY = CursorPrevY = BRANCHES_CLOUD_Y;
reset_vars();
current_branch = -1; // -1 = root
changes_since_current_branch = false;
fireball_size = 0;
// set cloud_time and current_pos_time
SetCurrentPosTime();
strcpy(cloud_time, current_pos_time);
}
void BOOKMARKS::reset_vars()
{
transition_phase = animation_frame = 0;
mouse_x = mouse_y = -1;
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
mouse_over_bitmap = false;
must_recalculate_branches_tree = must_redraw_branches_tree = must_check_item_under_mouse = true;
check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK;
next_animation_time = clock() + BRANCHES_ANIMATION_TICK;
}
void BOOKMARKS::free()
{
bookmarks_array.resize(0);
@ -204,6 +171,40 @@ void BOOKMARKS::free()
branchesSpritesheet = NULL;
}
}
void BOOKMARKS::reset()
{
// init bookmarks
bookmarks_array.resize(0);
bookmarks_array.resize(TOTAL_BOOKMARKS);
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
bookmarks_array[i].init();
for (int i = TOTAL_BOOKMARKS; i >= 0; i--)
{
BranchX[i] = BranchPrevX[i] = BranchCurrX[i] = EMPTY_BRANCHES_X;
BranchY[i] = BranchPrevY[i] = BranchCurrY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
CursorX = CursorPrevX = CloudX = CloudPrevX = BRANCHES_CLOUD_X;
CursorY = CursorPrevY = BRANCHES_CLOUD_Y;
reset_vars();
current_branch = -1; // -1 = root
changes_since_current_branch = false;
fireball_size = 0;
// set cloud_time and current_pos_time
SetCurrentPosTime();
strcpy(cloud_time, current_pos_time);
}
void BOOKMARKS::reset_vars()
{
transition_phase = animation_frame = 0;
mouse_x = mouse_y = -1;
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
mouse_over_bitmap = false;
must_recalculate_branches_tree = must_redraw_branches_tree = must_check_item_under_mouse = true;
check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK;
next_animation_time = clock() + BRANCHES_ANIMATION_TICK;
}
void BOOKMARKS::update()
{

View File

@ -3,9 +3,12 @@
#define TOTAL_BOOKMARKS 10
#define EDIT_MODE_BOOKMARKS 0
#define EDIT_MODE_BOTH 1
#define EDIT_MODE_BRANCHES 2
enum
{
EDIT_MODE_BOOKMARKS = 0,
EDIT_MODE_BOTH = 1,
EDIT_MODE_BRANCHES = 2,
};
#define ITEM_UNDER_MOUSE_NONE -2
#define ITEM_UNDER_MOUSE_CLOUD -1
@ -77,9 +80,12 @@
#define BRANCHES_CORNER4_SPRITESHEET_Y 7
#define BRANCHES_CORNER_BASE_SHIFT 6
// listview columns
#define BOOKMARKS_COLUMN_ICON 0
#define BOOKMARKS_COLUMN_FRAME 1
#define BOOKMARKS_COLUMN_TIME 2
enum
{
BOOKMARKS_COLUMN_ICON = 0,
BOOKMARKS_COLUMN_FRAME = 1,
BOOKMARKS_COLUMN_TIME = 2,
};
#define BOOKMARKS_ID_LEN 10
#define TIME_DESC_LENGTH 9 // "HH:MM:SS"

View File

@ -14,6 +14,9 @@ extern GREENZONE greenzone;
extern TASEDITOR_PROJECT project;
extern TASEDITOR_LIST list;
extern int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES];
extern int GetInputType(MovieData& md);
char history_save_id[HISTORY_ID_LEN] = "HISTORY";
char history_skipsave_id[HISTORY_ID_LEN] = "HISTORX";
char modCaptions[41][20] = {" Init",
@ -384,13 +387,16 @@ void INPUT_HISTORY::RegisterRecording(int frame_of_change)
strcat(inp.description, modCaptions[MODTYPE_RECORD]);
char framenum[11];
// check if current snapshot is also Recording and maybe it is consecutive recording
if (taseditor_config.combine_consecutive_rec && input_snapshots[real_pos].mod_type == MODTYPE_RECORD && input_snapshots[real_pos].rec_end_frame+1 == frame_of_change && input_snapshots[real_pos].rec_joypad_diff_bits == inp.rec_joypad_diff_bits)
if (taseditor_config.combine_consecutive_rec
&& input_snapshots[real_pos].mod_type == MODTYPE_RECORD // a) also Recording
&& input_snapshots[real_pos].rec_end_frame+1 == frame_of_change // b) consecutive
&& input_snapshots[real_pos].rec_joypad_diff_bits == inp.rec_joypad_diff_bits) // c) recorded same set of joysticks
{
// clone this snapshot and continue chain of recorded frames
inp.jump_frame = input_snapshots[real_pos].jump_frame;
inp.rec_end_frame = frame_of_change;
// add info which joypads were affected
int num = (inp.input_type + 1) * 2; // = joypads_per_frame
int num = joysticks_per_frame[inp.input_type];
uint32 current_mask = 1;
for (int i = 0; i < num; ++i)
{
@ -421,7 +427,7 @@ void INPUT_HISTORY::RegisterRecording(int frame_of_change)
// not consecutive - add new snapshot to history
inp.jump_frame = inp.rec_end_frame = frame_of_change;
// add info which joypads were affected
int num = (inp.input_type + 1) * 2; // = joypads_per_frame
int num = joysticks_per_frame[inp.input_type];
uint32 current_mask = 1;
for (int i = 0; i < num; ++i)
{
@ -447,7 +453,7 @@ void INPUT_HISTORY::RegisterImport(MovieData& md, char* filename)
{
// create new input snapshot
INPUT_SNAPSHOT inp;
inp.init(md, taseditor_config.enable_hot_changes, (currMovieData.fourscore)?FOURSCORE:NORMAL_2JOYPADS);
inp.init(md, taseditor_config.enable_hot_changes, GetInputType(currMovieData));
// check if there are input differences from latest snapshot
int real_pos = (history_start_pos + history_cursor_pos) % history_size;
int first_changes = inp.findFirstChange(input_snapshots[real_pos]);

View File

@ -1,49 +1,50 @@
//Specification file for Input History class
#define UNDO_HINT_TIME 200
#define MODTYPE_INIT 0
#define MODTYPE_CHANGE 1 // deprecated
#define MODTYPE_SET 2
#define MODTYPE_UNSET 3
#define MODTYPE_INSERT 4
#define MODTYPE_DELETE 5
#define MODTYPE_TRUNCATE 6
#define MODTYPE_CLEAR 7
#define MODTYPE_CUT 8
#define MODTYPE_PASTE 9
#define MODTYPE_PASTEINSERT 10
#define MODTYPE_CLONE 11
#define MODTYPE_RECORD 12
#define MODTYPE_IMPORT 13
#define MODTYPE_BRANCH_0 14
#define MODTYPE_BRANCH_1 15
#define MODTYPE_BRANCH_2 16
#define MODTYPE_BRANCH_3 17
#define MODTYPE_BRANCH_4 18
#define MODTYPE_BRANCH_5 19
#define MODTYPE_BRANCH_6 20
#define MODTYPE_BRANCH_7 21
#define MODTYPE_BRANCH_8 22
#define MODTYPE_BRANCH_9 23
#define MODTYPE_BRANCH_MARKERS_0 24
#define MODTYPE_BRANCH_MARKERS_1 25
#define MODTYPE_BRANCH_MARKERS_2 26
#define MODTYPE_BRANCH_MARKERS_3 27
#define MODTYPE_BRANCH_MARKERS_4 28
#define MODTYPE_BRANCH_MARKERS_5 29
#define MODTYPE_BRANCH_MARKERS_6 30
#define MODTYPE_BRANCH_MARKERS_7 31
#define MODTYPE_BRANCH_MARKERS_8 32
#define MODTYPE_BRANCH_MARKERS_9 33
#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 MODTYPE_LUA_CHANGE 40
enum
{
MODTYPE_INIT = 0,
MODTYPE_CHANGE = 1, // deprecated
MODTYPE_SET = 2,
MODTYPE_UNSET = 3,
MODTYPE_INSERT = 4,
MODTYPE_DELETE = 5,
MODTYPE_TRUNCATE = 6,
MODTYPE_CLEAR = 7,
MODTYPE_CUT = 8,
MODTYPE_PASTE = 9,
MODTYPE_PASTEINSERT = 10,
MODTYPE_CLONE = 11,
MODTYPE_RECORD = 12,
MODTYPE_IMPORT = 13,
MODTYPE_BRANCH_0 = 14,
MODTYPE_BRANCH_1 = 15,
MODTYPE_BRANCH_2 = 16,
MODTYPE_BRANCH_3 = 17,
MODTYPE_BRANCH_4 = 18,
MODTYPE_BRANCH_5 = 19,
MODTYPE_BRANCH_6 = 20,
MODTYPE_BRANCH_7 = 21,
MODTYPE_BRANCH_8 = 22,
MODTYPE_BRANCH_9 = 23,
MODTYPE_BRANCH_MARKERS_0 = 24,
MODTYPE_BRANCH_MARKERS_1 = 25,
MODTYPE_BRANCH_MARKERS_2 = 26,
MODTYPE_BRANCH_MARKERS_3 = 27,
MODTYPE_BRANCH_MARKERS_4 = 28,
MODTYPE_BRANCH_MARKERS_5 = 29,
MODTYPE_BRANCH_MARKERS_6 = 30,
MODTYPE_BRANCH_MARKERS_7 = 31,
MODTYPE_BRANCH_MARKERS_8 = 32,
MODTYPE_BRANCH_MARKERS_9 = 33,
MODTYPE_MARKER_SET = 34,
MODTYPE_MARKER_UNSET = 35,
MODTYPE_MARKER_RENAME = 36,
MODTYPE_LUA_MARKER_SET = 37,
MODTYPE_LUA_MARKER_UNSET = 38,
MODTYPE_LUA_MARKER_RENAME = 39,
MODTYPE_LUA_CHANGE = 40,
};
#define HISTORY_NORMAL_COLOR 0x000000
#define HISTORY_INCOHERENT_COLOR 0x999999

View File

@ -2,11 +2,13 @@
#include "taseditor_project.h"
#include "zlib.h"
const int bytes_per_frame[NUM_SUPPORTED_INPUT_TYPES] = {2, 4}; // so 16bits for normal joypads, 32bits for fourscore
int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES] = {1, 2, 4};
extern MARKERS current_markers;
extern TASEDITOR_SELECTION selection;
extern int GetInputType(MovieData& md);
INPUT_SNAPSHOT::INPUT_SNAPSHOT()
{
}
@ -15,21 +17,21 @@ void INPUT_SNAPSHOT::init(MovieData& md, bool hotchanges, int force_input_type)
{
has_hot_changes = hotchanges;
if (force_input_type < 0)
input_type = (md.fourscore)?FOURSCORE:NORMAL_2JOYPADS;
input_type = GetInputType(md);
else
input_type = force_input_type;
// retrieve input data from movie data
size = md.getNumRecords();
joysticks.resize(bytes_per_frame[input_type] * size); // it's much faster to have this format than have [frame][joy] or other structures
commands.resize(size);
joysticks.resize(BYTES_PER_JOYSTICK * joysticks_per_frame[input_type] * size); // it's much faster to have this format than have [frame][joy] or other structures
commands.resize(size); // commands take 1 byte per frame
if (has_hot_changes)
hot_changes.resize(bytes_per_frame[input_type] * size * HOTCHANGE_BYTES_PER_JOY);
hot_changes.resize(joysticks_per_frame[input_type] * size * HOTCHANGE_BYTES_PER_JOY);
// fill input vector
int pos = 0;
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
for (int frame = 0; frame < size; ++frame)
{
@ -41,7 +43,7 @@ void INPUT_SNAPSHOT::init(MovieData& md, bool hotchanges, int force_input_type)
}
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
for (int frame = 0; frame < size; ++frame)
{
@ -51,6 +53,15 @@ void INPUT_SNAPSHOT::init(MovieData& md, bool hotchanges, int force_input_type)
}
break;
}
case INPUT_TYPE_1P:
{
for (int frame = 0; frame < size; ++frame)
{
joysticks[pos++] = md.records[frame].joysticks[0];
commands[frame] = md.records[frame].commands;
}
break;
}
}
// make a copy of current_markers
@ -60,7 +71,7 @@ void INPUT_SNAPSHOT::init(MovieData& md, bool hotchanges, int force_input_type)
coherent = true;
already_compressed = false;
// save time to description
// save current time to description
time_t raw_time;
time(&raw_time);
struct tm * timeinfo = localtime(&raw_time);
@ -79,9 +90,9 @@ void INPUT_SNAPSHOT::toMovie(MovieData& md, int start, int end)
md.records.resize(size);
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
int pos = start * bytes_per_frame[input_type];
int pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type];
for (int frame = start; frame <= end; ++frame)
{
md.records[frame].joysticks[0] = joysticks[pos++];
@ -92,9 +103,9 @@ void INPUT_SNAPSHOT::toMovie(MovieData& md, int start, int end)
}
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
int pos = start * bytes_per_frame[input_type];
int pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type];
for (int frame = start; frame <= end; ++frame)
{
md.records[frame].joysticks[0] = joysticks[pos++];
@ -103,6 +114,16 @@ void INPUT_SNAPSHOT::toMovie(MovieData& md, int start, int end)
}
break;
}
case INPUT_TYPE_1P:
{
int pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type];
for (int frame = start; frame <= end; ++frame)
{
md.records[frame].joysticks[0] = joysticks[pos++];
md.records[frame].commands = commands[frame];
}
break;
}
}
}
@ -192,7 +213,7 @@ bool INPUT_SNAPSHOT::load(EMUFILE *is)
int comprlen;
uLongf destlen;
// read and uncompress joysticks data
destlen = size * bytes_per_frame[input_type];
destlen = size * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type];
joysticks.resize(destlen);
// read size
if (!read32le(&comprlen, is)) return true;
@ -214,7 +235,7 @@ bool INPUT_SNAPSHOT::load(EMUFILE *is)
if (has_hot_changes)
{
// read and uncompress hot_changes data
destlen = size * bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
destlen = size * joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
hot_changes.resize(destlen);
// read size
if (!read32le(&comprlen, is)) return true;
@ -280,13 +301,14 @@ void INPUT_SNAPSHOT::fillJoypadsDiff(INPUT_SNAPSHOT& inp, int frame)
uint32 current_mask = 1;
switch(input_type)
{
case FOURSCORE:
case NORMAL_2JOYPADS:
case INPUT_TYPE_FOURSCORE:
case INPUT_TYPE_2P:
case INPUT_TYPE_1P:
{
int pos = frame * bytes_per_frame[input_type];
for (int i = 0; i < bytes_per_frame[input_type]; ++i) // this should be actually joypads_per_frame[]
int pos = frame * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type];
for (int i = 0; i < BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; ++i)
{
if (pos < (inp.size * bytes_per_frame[input_type]))
if (pos < (inp.size * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]))
{
if (joysticks[pos+i] != inp.joysticks[pos+i]) rec_joypad_diff_bits |= current_mask;
} else
@ -308,9 +330,9 @@ int INPUT_SNAPSHOT::findFirstChange(INPUT_SNAPSHOT& inp, int start, int end)
int inp_end = inp.size;
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// return the frame if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
@ -335,9 +357,9 @@ int INPUT_SNAPSHOT::findFirstChange(INPUT_SNAPSHOT& inp, int start, int end)
}
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// return the frame if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
@ -356,6 +378,24 @@ int INPUT_SNAPSHOT::findFirstChange(INPUT_SNAPSHOT& inp, int start, int end)
}
break;
}
case INPUT_TYPE_1P:
{
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// return the frame if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
{
if (joysticks[pos] != inp.joysticks[pos]) return frame;
pos++;
if (commands[frame] != inp.commands[frame]) return frame;
} else
{
if (joysticks[pos++]) return frame;
if (commands[frame]) return frame;
}
}
break;
}
}
// if current size is less then previous, return size-1 as the frame of difference
if (size < inp_end) return size-1;
@ -371,9 +411,9 @@ int INPUT_SNAPSHOT::findFirstChange(MovieData& md, int start, int end)
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
if (joysticks[pos++] != md.records[frame].joysticks[0]) return frame;
if (joysticks[pos++] != md.records[frame].joysticks[1]) return frame;
@ -383,9 +423,9 @@ int INPUT_SNAPSHOT::findFirstChange(MovieData& md, int start, int end)
}
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
if (joysticks[pos++] != md.records[frame].joysticks[0]) return frame;
if (joysticks[pos++] != md.records[frame].joysticks[1]) return frame;
@ -393,6 +433,15 @@ int INPUT_SNAPSHOT::findFirstChange(MovieData& md, int start, int end)
}
break;
}
case INPUT_TYPE_1P:
{
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
if (joysticks[pos++] != md.records[frame].joysticks[0]) return frame;
if (commands[frame] != md.records[frame].commands) return frame;
}
break;
}
}
// if sizes differ, return last frame from the lesser of them
if (size != md.getNumRecords()) return end;
@ -405,11 +454,11 @@ int INPUT_SNAPSHOT::GetJoystickInfo(int frame, int joy)
if (frame < 0 || frame >= size) return 0;
switch(input_type)
{
case FOURSCORE:
case NORMAL_2JOYPADS:
case INPUT_TYPE_FOURSCORE:
case INPUT_TYPE_2P:
case INPUT_TYPE_1P:
{
return joysticks[frame * bytes_per_frame[input_type] + joy];
break;
return joysticks[frame * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type] + joy];
}
}
return 0;
@ -427,8 +476,8 @@ void INPUT_SNAPSHOT::copyHotChanges(INPUT_SNAPSHOT* source_of_hotchanges, int li
// special case for Branches: if limit_frame if specified, then copy only hotchanges from 0 to limit_frame
if (limit_frame_of_source >= 0)
{
if (min > limit_frame_of_source * bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY)
min = limit_frame_of_source * bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
if (min > limit_frame_of_source * joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY)
min = limit_frame_of_source * joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
}
memcpy(&hot_changes[0], &source_of_hotchanges->hot_changes[0], min);
@ -452,7 +501,7 @@ void INPUT_SNAPSHOT::inheritHotChanges_DeleteSelection(INPUT_SNAPSHOT* source_of
// copy hot changes from source snapshot, but omit deleted frames (which are represented by current selection)
if (source_of_hotchanges && source_of_hotchanges->has_hot_changes)
{
int bytes = bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0, source_pos = 0;
int this_size = hot_changes.size(), source_size = source_of_hotchanges->hot_changes.size();
SelectionFrames::iterator it(selection.GetStrobedSelection().begin());
@ -481,7 +530,7 @@ void INPUT_SNAPSHOT::inheritHotChanges_InsertSelection(INPUT_SNAPSHOT* source_of
// copy hot changes from source snapshot, but insert filled lines for inserted frames (which are represented by current selection)
if (source_of_hotchanges && source_of_hotchanges->has_hot_changes)
{
int bytes = bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, region_len = 0, pos = 0, source_pos = 0;
int this_size = hot_changes.size(), source_size = source_of_hotchanges->hot_changes.size();
SelectionFrames::iterator it(selection.GetStrobedSelection().begin());
@ -511,7 +560,7 @@ void INPUT_SNAPSHOT::inheritHotChanges_InsertSelection(INPUT_SNAPSHOT* source_of
} else
{
// no old data, just fill selected lines
int bytes = bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, region_len = 0, pos = 0;
int this_size = hot_changes.size();
SelectionFrames::iterator it(selection.GetStrobedSelection().begin());
@ -544,7 +593,7 @@ void INPUT_SNAPSHOT::inheritHotChanges_PasteInsert(INPUT_SNAPSHOT* source_of_hot
// copy hot changes from source snapshot and insert filled lines for inserted frames (which are represented by inserted_set)
if (source_of_hotchanges && source_of_hotchanges->has_hot_changes)
{
int bytes = bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0, source_pos = 0;
int this_size = hot_changes.size(), source_size = source_of_hotchanges->hot_changes.size();
SelectionFrames::iterator it(selection.GetInsertedSet().begin());
@ -570,7 +619,7 @@ void INPUT_SNAPSHOT::inheritHotChanges_PasteInsert(INPUT_SNAPSHOT* source_of_hot
} else
{
// no old data, just fill selected lines
int bytes = bytes_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0;
int this_size = hot_changes.size();
SelectionFrames::iterator it(selection.GetInsertedSet().begin());
@ -602,9 +651,9 @@ void INPUT_SNAPSHOT::fillHotChanges(INPUT_SNAPSHOT& inp, int start, int end)
int inp_end = inp.size;
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// set changed if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
@ -639,9 +688,9 @@ void INPUT_SNAPSHOT::fillHotChanges(INPUT_SNAPSHOT& inp, int start, int end)
}
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
for (int frame = start, pos = start * bytes_per_frame[input_type]; frame <= end; ++frame)
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// set changed if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
@ -664,6 +713,25 @@ void INPUT_SNAPSHOT::fillHotChanges(INPUT_SNAPSHOT& inp, int start, int end)
}
break;
}
case INPUT_TYPE_1P:
{
for (int frame = start, pos = start * BYTES_PER_JOYSTICK * joysticks_per_frame[input_type]; frame <= end; ++frame)
{
// set changed if found different byte, or found emptiness in inp when there's non-zero value here
if (frame < inp_end)
{
if (joysticks[pos] != inp.joysticks[pos])
SetMaxHotChange_Bits(frame, 0, joysticks[pos] ^ inp.joysticks[pos]);
pos++;
} else
{
if (joysticks[pos])
SetMaxHotChange_Bits(frame, 0, joysticks[pos]);
pos++;
}
}
break;
}
}
}
@ -684,7 +752,7 @@ void INPUT_SNAPSHOT::SetMaxHotChange(int frame, int absolute_button)
// set max value (15) to the button hotness
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
// 32 buttons = 16bytes
if (absolute_button & 1)
@ -695,7 +763,7 @@ void INPUT_SNAPSHOT::SetMaxHotChange(int frame, int absolute_button)
hot_changes[(frame << 4) | (absolute_button >> 1)] |= 0x0F;
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
// 16 buttons = 8bytes
if (absolute_button & 1)
@ -706,6 +774,17 @@ void INPUT_SNAPSHOT::SetMaxHotChange(int frame, int absolute_button)
hot_changes[(frame << 3) | (absolute_button >> 1)] |= 0x0F;
break;
}
case INPUT_TYPE_1P:
{
// 8 buttons = 4bytes
if (absolute_button & 1)
// odd buttons (B, T, D, R) - set upper 4 bits of the byte
hot_changes[(frame << 2) | (absolute_button >> 1)] |= 0xF0;
else
// even buttons (A, S, U, L) - set lower 4 bits of the byte
hot_changes[(frame << 2) | (absolute_button >> 1)] |= 0x0F;
break;
}
}
}
@ -727,24 +806,30 @@ void INPUT_SNAPSHOT::FadeHotChanges()
int INPUT_SNAPSHOT::GetHotChangeInfo(int frame, int absolute_button)
{
if (!has_hot_changes || frame < 0 || frame >= size || absolute_button < 0 || absolute_button > 31)
if (!has_hot_changes || frame < 0 || frame >= size || absolute_button < 0 || absolute_button >= NUM_JOYPAD_BUTTONS * joysticks_per_frame[input_type])
return 0;
uint8 val;
switch(input_type)
{
case FOURSCORE:
case INPUT_TYPE_FOURSCORE:
{
// 32 buttons, 16bytes
val = hot_changes[(frame << 4) + (absolute_button >> 1)];
break;
}
case NORMAL_2JOYPADS:
case INPUT_TYPE_2P:
{
// 16 buttons, 8bytes
val = hot_changes[(frame << 3) + (absolute_button >> 1)];
break;
}
case INPUT_TYPE_1P:
{
// 8 buttons, 4bytes
val = hot_changes[(frame << 2) + (absolute_button >> 1)];
break;
}
}
if (absolute_button & 1)

View File

@ -1,12 +1,18 @@
//Specification file for Input Snapshot class
enum Input_types
{
INPUT_TYPE_1P,
INPUT_TYPE_2P,
INPUT_TYPE_FOURSCORE,
NUM_SUPPORTED_INPUT_TYPES
};
#define BYTES_PER_JOYSTICK 1 // 1 byte per 1 joystick (8 buttons)
#define HOTCHANGE_BYTES_PER_JOY 4 // 4 bytes per 8 buttons
#define HOTCHANGE_BYTES_PER_JOY 4
#define SNAPSHOT_DESC_MAX_LENGTH 100
#define NUM_SUPPORTED_INPUT_TYPES 2
#define NORMAL_2JOYPADS 0
#define FOURSCORE 1
class INPUT_SNAPSHOT
{
public:
@ -43,7 +49,7 @@ public:
int GetHotChangeInfo(int frame, int absolute_button);
int size; // in frames
int input_type; // 0=normal, 1=fourscore; theoretically TAS Editor can support other input types, although some stuff may be unintentionally hardcoded
int input_type; // theoretically TAS Editor can support any other input types
std::vector<uint8> joysticks; // Format: joy0-for-frame0, joy1-for-frame0, joy2-for-frame0, joy3-for-frame0, joy0-for-frame1, joy1-for-frame1, ...
std::vector<uint8> commands; // Format: commands-for-frame0, commands-for-frame1, ...
std::vector<uint8> hot_changes; // Format: buttons01joy0-for-frame0, buttons23joy0-for-frame0, buttons45joy0-for-frame0, buttons67joy0-for-frame0, buttons01joy1-for-frame0, ...

View File

@ -394,6 +394,12 @@ void MARKERS::FindSimilar(int offset)
MessageBox(taseditor_window.hwndTasEditor, "Marker Note under Playback cursor is empty!", "Find Similar Note", MB_OK);
return;
}
// check if there's at least one note (not counting zeroth note)
if (notes.size() <= 0)
{
MessageBox(taseditor_window.hwndTasEditor, "This project doesn't have any Markers!", "Find Similar Note", MB_OK);
return;
}
// 0 - divide source string into keywords
int totalSourceKeywords = 0;
@ -564,9 +570,10 @@ void MARKERS::FindSimilar(int offset)
*/
// Send selection to the marker found
if (notePriority[notePriority.size()-1 - offset].second >= MIN_PRIORITY_TRESHOLD)
int index = notePriority.size()-1 - offset;
if (index >= 0 && notePriority[index].second >= MIN_PRIORITY_TRESHOLD)
{
int marker_id = notePriority[notePriority.size()-1 - offset].first;
int marker_id = notePriority[index].first;
int frame = GetMarkerFrame(marker_id);
if (frame >= 0)
selection.JumpToFrame(frame);

View File

@ -1,6 +1,6 @@
//Specification file for Markers class
#define MARKERS_ID_LEN 8
#define MAX_NOTE_LEN 80
#define MAX_NOTE_LEN 100
// constants for "Find Similar Note" algorithm (may need finetuning)
#define KEYWORD_MIN_LEN 2

View File

@ -1,6 +1,6 @@
//Implementation file of Playback class
#include "taseditor_project.h"
#include "..\tasedit.h" // only for MARKER_NOTE_EDIT_UPPER
#include "..\taseditor.h" // only for MARKER_NOTE_EDIT_UPPER
#ifdef _S9XLUA_H
extern void ForceExecuteLuaFrameFunctions();
@ -34,10 +34,10 @@ void PLAYBACK::init()
{
hwndProgressbar = GetDlgItem(taseditor_window.hwndTasEditor, IDC_PROGRESS1);
SendMessage(hwndProgressbar, PBM_SETRANGE, 0, MAKELPARAM(0, PROGRESSBAR_WIDTH));
hwndRewind = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_REWIND);
hwndForward = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_FORWARD);
hwndRewindFull = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_REWIND_FULL);
hwndForwardFull = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_FORWARD_FULL);
hwndRewind = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_REWIND);
hwndForward = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_FORWARD);
hwndRewindFull = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_REWIND_FULL);
hwndForwardFull = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_FORWARD_FULL);
hwndPlaybackMarker = GetDlgItem(taseditor_window.hwndTasEditor, IDC_PLAYBACK_MARKER);
SendMessage(hwndPlaybackMarker, WM_SETFONT, (WPARAM)list.hMarkersFont, 0);
hwndPlaybackMarkerEdit = GetDlgItem(taseditor_window.hwndTasEditor, IDC_PLAYBACK_MARKER_EDIT);

View File

@ -79,16 +79,8 @@ void POPUP_DISPLAY::init()
}
HDC win_hdc = GetWindowDC(list.hwndList);
scr_bmp = CreateDIBSection(win_hdc, scr_bmi, DIB_RGB_COLORS, (void**)&scr_ptr, 0, 0);
// calculate coordinates (relative to IDC_BOOKMARKS_BOX)
RECT temp_rect, parent_rect;
GetWindowRect(taseditor_window.hwndTasEditor, &parent_rect);
GetWindowRect(GetDlgItem(taseditor_window.hwndTasEditor, IDC_BOOKMARKS_BOX), &temp_rect);
scr_bmp_x = temp_rect.left - SCREENSHOT_WIDTH - SCR_BMP_DX - parent_rect.left;
//scr_bmp_y = ((temp_rect.bottom + temp_rect.top - (SCREENSHOT_HEIGHT + SCR_BMP_TOOLTIP_GAP + MARKER_NOTE_TOOLTIP_HEIGHT)) / 2) - parent_rect.top;
scr_bmp_y = (temp_rect.bottom - SCREENSHOT_HEIGHT) - parent_rect.top;
tooltip_x = scr_bmp_x + SCREENSHOT_WIDTH - MARKER_NOTE_TOOLTIP_WIDTH;
//tooltip_y = scr_bmp_y + SCREENSHOT_HEIGHT + SCR_BMP_TOOLTIP_GAP;
tooltip_y = scr_bmp_y + SCREENSHOT_HEIGHT + SCR_BMP_TOOLTIP_GAP;
// calculate coordinates
ParentWindowMoved();
}
void POPUP_DISPLAY::free()
{
@ -233,6 +225,15 @@ void POPUP_DISPLAY::ChangeTooltipText()
void POPUP_DISPLAY::ParentWindowMoved()
{
// calculate new positions relative to IDC_BOOKMARKS_BOX
RECT temp_rect, parent_rect;
GetWindowRect(taseditor_window.hwndTasEditor, &parent_rect);
GetWindowRect(GetDlgItem(taseditor_window.hwndTasEditor, IDC_BOOKMARKS_BOX), &temp_rect);
scr_bmp_x = temp_rect.left - SCREENSHOT_WIDTH - SCR_BMP_DX - parent_rect.left;
scr_bmp_y = (temp_rect.bottom - SCREENSHOT_HEIGHT) - parent_rect.top;
tooltip_x = scr_bmp_x + (SCREENSHOT_WIDTH - MARKER_NOTE_TOOLTIP_WIDTH) / 2;
tooltip_y = scr_bmp_y + SCREENSHOT_HEIGHT + SCR_BMP_TOOLTIP_GAP;
// if popup windows are currently shown, update their positions
if (hwndScrBmp)
SetWindowPos(hwndScrBmp, 0, taseditor_config.wndx + scr_bmp_x, taseditor_config.wndy + scr_bmp_y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
if (hwndMarkerNoteTooltip)
@ -263,6 +264,7 @@ LRESULT APIENTRY MarkerNoteTooltipWndProc(HWND hwnd, UINT message, WPARAM wParam
{
// create static text field
popup_display.marker_note_tooltip = CreateWindow(WC_STATIC, NULL, WS_CHILD | WS_VISIBLE | SS_CENTER | SS_SUNKEN, 1, 1, MARKER_NOTE_TOOLTIP_WIDTH - 2, MARKER_NOTE_TOOLTIP_HEIGHT - 2, hwnd, NULL, NULL, NULL);
SendMessage(popup_display.marker_note_tooltip, WM_SETFONT, (WPARAM)list.hMarkersEditFont, 0);
return 0;
}
default:

View File

@ -2,8 +2,11 @@
#include "taseditor_project.h"
#include "zlib.h"
extern int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES];
extern uint32 GetGamepadPressedImmediate();
extern void ColumnSet(int column);
extern int GetInputType(MovieData& md);
extern TASEDITOR_CONFIG taseditor_config;
extern TASEDITOR_WINDOW taseditor_window;
@ -30,17 +33,16 @@ RECORDER::RECORDER()
void RECORDER::init()
{
hwndRecCheckbox = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RECORDING);
hwndRB_RecAll = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO2);
hwndRB_Rec1P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO3);
hwndRB_Rec2P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO4);
hwndRB_Rec3P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO5);
hwndRB_Rec4P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO6);
reset();
hwndRB_RecAll = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO_ALL);
hwndRB_Rec1P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO_1P);
hwndRB_Rec2P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO_2P);
hwndRB_Rec3P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO_3P);
hwndRB_Rec4P = GetDlgItem(taseditor_window.hwndTasEditor, IDC_RADIO_4P);
old_multitrack_recording_joypad = multitrack_recording_joypad;
old_movie_readonly = movie_readonly;
old_joy.resize(4);
new_joy.resize(4);
current_joy.resize(4);
old_joy.resize(MAX_NUM_JOYPADS);
new_joy.resize(MAX_NUM_JOYPADS);
current_joy.resize(MAX_NUM_JOYPADS);
}
void RECORDER::reset()
{
@ -48,23 +50,44 @@ void RECORDER::reset()
multitrack_recording_joypad = MULTITRACK_RECORDING_ALL;
UncheckRecordingRadioButtons();
RecheckRecordingRadioButtons();
if (currMovieData.fourscore)
switch (GetInputType(currMovieData))
{
// enable radiobuttons for 3P/4P multitracking
case INPUT_TYPE_FOURSCORE:
{
// enable all 4 radiobuttons
EnableWindow(hwndRB_Rec1P, true);
EnableWindow(hwndRB_Rec2P, true);
EnableWindow(hwndRB_Rec3P, true);
EnableWindow(hwndRB_Rec4P, true);
} else
break;
}
case INPUT_TYPE_2P:
{
// disable radiobuttons for 3P/4P multitracking
// enable radiobuttons 1 and 2
EnableWindow(hwndRB_Rec1P, true);
EnableWindow(hwndRB_Rec2P, true);
// disable radiobuttons 3 and 4
EnableWindow(hwndRB_Rec3P, false);
EnableWindow(hwndRB_Rec4P, false);
break;
}
case INPUT_TYPE_1P:
{
// enable radiobutton 1
EnableWindow(hwndRB_Rec1P, true);
// disable radiobuttons 2, 3 and 4
EnableWindow(hwndRB_Rec2P, false);
EnableWindow(hwndRB_Rec3P, false);
EnableWindow(hwndRB_Rec4P, false);
break;
}
}
}
void RECORDER::update()
{
// update window caption if needed
if (old_movie_readonly != movie_readonly || old_multitrack_recording_joypad != multitrack_recording_joypad)
taseditor_window.RedrawCaption();
taseditor_window.UpdateCaption();
// update Bookmarks/Branches groupbox caption if needed
if (taseditor_config.branch_only_when_rec && old_movie_readonly != movie_readonly)
bookmarks.RedrawBookmarksCaption();
@ -75,6 +98,8 @@ void RECORDER::update()
RecheckRecordingRadioButtons();
}
int num_joys = joysticks_per_frame[GetInputType(currMovieData)];
// save previous state
old_joy[0] = current_joy[0];
old_joy[1] = current_joy[1];
old_joy[2] = current_joy[2];
@ -85,6 +110,7 @@ void RECORDER::update()
current_joy[1] = ((joypads >> 8) & 0xFF);
current_joy[2] = ((joypads >> 16) & 0xFF);
current_joy[3] = ((joypads >> 24) & 0xFF);
// filter out joysticks that should not be recorded (according to multitrack_recording_joypad)
if (multitrack_recording_joypad != MULTITRACK_RECORDING_ALL)
{
int joy = multitrack_recording_joypad - 1;
@ -92,18 +118,13 @@ void RECORDER::update()
if (multitrack_recording_joypad > MULTITRACK_RECORDING_1P && taseditor_config.use_1p_rec)
current_joy[joy] = current_joy[0];
// clear all other joypads (pressing them does not count)
for (int i = 0; i < NUM_JOYPADS; ++i)
for (int i = 0; i < num_joys; ++i)
if (i != joy)
current_joy[i] = 0;
}
// call ColumnSet if needed
if (taseditor_config.columnset_by_keys && movie_readonly && taseditor_window.TASEditor_focus)
{
int num_joys;
if (currMovieData.fourscore)
num_joys = NUM_JOYPADS;
else
num_joys = 2;
for (int joy = 0; joy < num_joys; ++joy)
{
for (int button = 0; button < NUM_JOYPAD_BUTTONS; ++button)
@ -152,23 +173,17 @@ void RECORDER::RecheckRecordingRadioButtons()
void RECORDER::InputChanged()
{
bool changes_made = false;
int num_joys = joysticks_per_frame[GetInputType(currMovieData)];
// take previous values from current snapshot, new input from current movie
old_joy[0] = history.GetCurrentSnapshot().GetJoystickInfo(currFrameCounter, 0);
new_joy[0] = currMovieData.records[currFrameCounter].joysticks[0];
old_joy[1] = history.GetCurrentSnapshot().GetJoystickInfo(currFrameCounter, 1);
new_joy[1] = currMovieData.records[currFrameCounter].joysticks[1];
if (currMovieData.fourscore)
for (int i = 0; i < num_joys; ++i)
{
old_joy[2] = history.GetCurrentSnapshot().GetJoystickInfo(currFrameCounter, 2);
new_joy[2] = currMovieData.records[currFrameCounter].joysticks[2];
old_joy[3] = history.GetCurrentSnapshot().GetJoystickInfo(currFrameCounter, 3);
new_joy[3] = currMovieData.records[currFrameCounter].joysticks[3];
old_joy[i] = history.GetCurrentSnapshot().GetJoystickInfo(currFrameCounter, i);
new_joy[i] = currMovieData.records[currFrameCounter].joysticks[i];
}
// combine old and new data (superimpose) and filter out joystics that should not be recorded
if (multitrack_recording_joypad == MULTITRACK_RECORDING_ALL)
{
int i;
if (currMovieData.fourscore) i = 3; else i = 1;
for (; i >= 0; i--)
for (int i = num_joys-1; i >= 0; i--)
{
// superimpose (bitwise OR) if needed
if (taseditor_config.superimpose == BST_CHECKED || (taseditor_config.superimpose == BST_INDETERMINATE && new_joy[i] == 0))
@ -194,13 +209,8 @@ void RECORDER::InputChanged()
if (taseditor_config.superimpose == BST_CHECKED || (taseditor_config.superimpose == BST_INDETERMINATE && new_joy[joy] == 0))
new_joy[joy] |= old_joy[joy];
// other joysticks should not be changed
currMovieData.records[currFrameCounter].joysticks[0] = old_joy[0];
currMovieData.records[currFrameCounter].joysticks[1] = old_joy[1];
if (currMovieData.fourscore)
{
currMovieData.records[currFrameCounter].joysticks[2] = old_joy[2];
currMovieData.records[currFrameCounter].joysticks[3] = old_joy[3];
}
for (int i = num_joys-1; i >= 0; i--)
currMovieData.records[currFrameCounter].joysticks[i] = old_joy[i]; // revert to old
// change only this joystick
currMovieData.records[currFrameCounter].joysticks[joy] = new_joy[joy];
if (new_joy[joy] != old_joy[joy])

View File

@ -1,10 +1,12 @@
//Specification file for RECORDER class
#define MULTITRACK_RECORDING_ALL 0
#define MULTITRACK_RECORDING_1P 1
#define MULTITRACK_RECORDING_2P 2
#define MULTITRACK_RECORDING_3P 3
#define MULTITRACK_RECORDING_4P 4
enum
{
MULTITRACK_RECORDING_ALL = 0,
MULTITRACK_RECORDING_1P = 1,
MULTITRACK_RECORDING_2P = 2,
MULTITRACK_RECORDING_3P = 3,
MULTITRACK_RECORDING_4P = 4,
};
class RECORDER
{

View File

@ -0,0 +1,660 @@
//Implementation file of SPLICER class
#include <sstream>
#include "taseditor_project.h"
#include "../Win32InputBox.h"
extern TASEDITOR_WINDOW taseditor_window;
extern TASEDITOR_CONFIG taseditor_config;
extern INPUT_HISTORY history;
extern MARKERS current_markers;
extern PLAYBACK playback;
extern GREENZONE greenzone;
extern TASEDITOR_LIST list;
extern TASEDITOR_SELECTION selection;
extern int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES];
extern int GetInputType(MovieData& md);
// resources
char buttonNames[NUM_JOYPAD_BUTTONS][2] = {"A", "B", "S", "T", "U", "D", "L", "R"};
char selectionText[] = "Selection: ";
char selectionEmptyText[] = "Selection: no";
char numTextRow[] = "1 row, ";
char numTextRows[] = " rows, ";
char numTextColumn[] = "1 column";
char numTextColumns[] = " columns";
char clipboardText[] = "Clipboard: ";
char clipboardEmptyText[] = "Clipboard: empty";
SPLICER::SPLICER()
{
}
void SPLICER::init()
{
hwndTextSelection = GetDlgItem(taseditor_window.hwndTasEditor, IDC_TEXT_SELECTION);
hwndTextClipboard = GetDlgItem(taseditor_window.hwndTasEditor, IDC_TEXT_CLIPBOARD);
reset();
if (clipboard_selection.empty())
CheckClipboard();
RedrawTextClipboard();
}
void SPLICER::reset()
{
must_redraw_selection_text = true;
}
void SPLICER::update()
{
// redraw selection info text of needed
if (must_redraw_selection_text)
{
int size = selection.GetCurrentSelectionSize();
if (size)
{
char new_text[100];
strcpy(new_text, selectionText);
char num[11];
// rows
if (size > 1)
{
_itoa(size, num, 10);
strcat(new_text, num);
strcat(new_text, numTextRows);
} else
{
strcat(new_text, numTextRow);
}
// columns
int columns = NUM_JOYPAD_BUTTONS * joysticks_per_frame[GetInputType(currMovieData)]; // in future the number of columns will depend on selected columns
if (columns > 1)
{
_itoa(columns, num, 10);
strcat(new_text, num);
strcat(new_text, numTextColumns);
} else
{
strcat(new_text, numTextColumn);
}
SetWindowText(hwndTextSelection, new_text);
} else
{
SetWindowText(hwndTextSelection, selectionEmptyText);
}
must_redraw_selection_text = false;
}
}
// ----------------------------------------------------------------------------------------------
void SPLICER::CloneFrames()
{
SelectionFrames* current_selection = selection.MakeStrobe();
int frames = current_selection->size();
if (!frames) return;
currMovieData.records.reserve(currMovieData.getNumRecords() + frames);
//insert frames before each selection, but consecutive selection lines are accounted as single region
frames = 1;
SelectionFrames::reverse_iterator next_it;
SelectionFrames::reverse_iterator current_selection_rend = current_selection->rend();
for(SelectionFrames::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++)
{
next_it = it;
next_it++;
if (next_it == current_selection_rend || (int)*next_it < ((int)*it - 1))
{
// end of current region
currMovieData.cloneRegion(*it, frames);
if (taseditor_config.bind_markers)
current_markers.insertEmpty(*it, frames);
frames = 1;
} else frames++;
}
if (taseditor_config.bind_markers)
{
current_markers.update();
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_CLONE, *current_selection->begin()));
}
void SPLICER::InsertFrames()
{
SelectionFrames* current_selection = selection.MakeStrobe();
int frames = current_selection->size();
if (!frames) return;
//to keep this from being even slower than it would otherwise be, go ahead and reserve records
currMovieData.records.reserve(currMovieData.getNumRecords() + frames);
//insert frames before each selection, but consecutive selection lines are accounted as single region
frames = 1;
SelectionFrames::reverse_iterator next_it;
SelectionFrames::reverse_iterator current_selection_rend = current_selection->rend();
for(SelectionFrames::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++)
{
next_it = it;
next_it++;
if (next_it == current_selection_rend || (int)*next_it < ((int)*it - 1))
{
// end of current region
currMovieData.insertEmpty(*it,frames);
if (taseditor_config.bind_markers)
current_markers.insertEmpty(*it,frames);
frames = 1;
} else frames++;
}
if (taseditor_config.bind_markers)
{
current_markers.update();
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_INSERT, *current_selection->begin()));
}
void SPLICER::InsertNumFrames()
{
SelectionFrames* current_selection = selection.MakeStrobe();
int frames = current_selection->size();
if(CWin32InputBox::GetInteger("Insert number of Frames", "How many frames?", frames, taseditor_window.hwndTasEditor) == IDOK)
{
if (frames > 0)
{
int index;
if (current_selection->size())
{
// insert at selection
index = *current_selection->begin();
selection.ClearSelection();
} else
{
// insert at playback cursor
index = currFrameCounter;
}
currMovieData.insertEmpty(index, frames);
if (taseditor_config.bind_markers)
{
current_markers.insertEmpty(index, frames);
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
// select inserted rows
list.update();
selection.SetRegionSelection(index, index + frames - 1);
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_INSERT, index));
}
}
}
void SPLICER::DeleteFrames()
{
SelectionFrames* current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return;
int start_index = *current_selection->begin();
int end_index = *current_selection->rbegin();
SelectionFrames::reverse_iterator current_selection_rend = current_selection->rend();
//delete frames on each selection, going backwards
for(SelectionFrames::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++)
{
currMovieData.records.erase(currMovieData.records.begin() + *it);
if (taseditor_config.bind_markers)
current_markers.EraseMarker(*it);
}
if (taseditor_config.bind_markers)
selection.must_find_current_marker = playback.must_find_current_marker = true;
// check if user deleted all frames
if (!currMovieData.getNumRecords())
playback.StartFromZero();
// reduce list
list.update();
int result = history.RegisterChanges(MODTYPE_DELETE, start_index);
if (result >= 0)
{
greenzone.InvalidateAndCheck(result);
} else if (greenzone.greenZoneCount >= currMovieData.getNumRecords())
{
greenzone.InvalidateAndCheck(currMovieData.getNumRecords()-1);
} else list.RedrawList();
}
void SPLICER::ClearFrames(SelectionFrames* current_selection)
{
bool cut = true;
if (!current_selection)
{
cut = false;
current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return;
}
//clear input on each selected frame
SelectionFrames::iterator current_selection_end(current_selection->end());
for(SelectionFrames::iterator it(current_selection->begin()); it != current_selection_end; it++)
{
currMovieData.records[*it].clear();
}
if (cut)
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_CUT, *current_selection->begin(), *current_selection->rbegin()));
else
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_CLEAR, *current_selection->begin(), *current_selection->rbegin()));
}
void SPLICER::Truncate()
{
int frame = selection.GetCurrentSelectionBeginning();
if (frame < 0) frame = currFrameCounter;
if (currMovieData.getNumRecords() > frame+1)
{
currMovieData.truncateAt(frame+1);
if (taseditor_config.bind_markers)
{
current_markers.SetMarkersSize(frame+1);
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
list.update();
int result = history.RegisterChanges(MODTYPE_TRUNCATE, frame+1);
if (result >= 0)
{
greenzone.InvalidateAndCheck(result);
} else if (greenzone.greenZoneCount >= currMovieData.getNumRecords())
{
greenzone.InvalidateAndCheck(currMovieData.getNumRecords()-1);
} else list.RedrawList();
}
}
bool SPLICER::Copy(SelectionFrames* current_selection)
{
if (!current_selection)
{
current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return false;
}
SelectionFrames::iterator current_selection_begin(current_selection->begin());
SelectionFrames::iterator current_selection_end(current_selection->end());
int num_joypads = joysticks_per_frame[GetInputType(currMovieData)];
int cframe = (*current_selection_begin) - 1;
try
{
int range = (*current_selection->rbegin() - *current_selection_begin) + 1;
std::stringstream clipString;
clipString << "TAS " << range << std::endl;
for(SelectionFrames::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (*it > cframe+1)
{
clipString << '+' << (*it-cframe) << '|';
}
cframe=*it;
int cjoy=0;
for (int joy = 0; joy < num_joypads; ++joy)
{
while (currMovieData.records[*it].joysticks[joy] && cjoy<joy)
{
clipString << '|';
++cjoy;
}
for (int bit=0; bit<NUM_JOYPAD_BUTTONS; ++bit)
{
if (currMovieData.records[*it].joysticks[joy] & (1<<bit))
{
clipString << buttonNames[bit];
}
}
}
clipString << std::endl;
if (!OpenClipboard(taseditor_window.hwndTasEditor))
return false;
EmptyClipboard();
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, clipString.str().size()+1);
if (hGlobal==INVALID_HANDLE_VALUE)
{
CloseClipboard();
return false;
}
char *pGlobal = (char*)GlobalLock(hGlobal);
strcpy(pGlobal, clipString.str().c_str());
GlobalUnlock(hGlobal);
SetClipboardData(CF_TEXT, hGlobal);
CloseClipboard();
}
}
catch (std::bad_alloc e)
{
return false;
}
// copied successfully
// memorize currently strobed selection data to clipboard_selection
clipboard_selection = *current_selection;
RedrawTextClipboard();
return true;
}
void SPLICER::Cut()
{
SelectionFrames* current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return;
if (Copy(current_selection))
{
ClearFrames(current_selection);
}
}
bool SPLICER::Paste()
{
SelectionFrames* current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return false;
if (!OpenClipboard(taseditor_window.hwndTasEditor)) return false;
SelectionFrames::iterator current_selection_begin(current_selection->begin());
int num_joypads = joysticks_per_frame[GetInputType(currMovieData)];
bool result = false;
int pos = *current_selection_begin;
HANDLE hGlobal = GetClipboardData(CF_TEXT);
if (hGlobal)
{
char *pGlobal = (char*)GlobalLock((HGLOBAL)hGlobal);
// TAS recording info starts with "TAS "
if (pGlobal[0]=='T' && pGlobal[1]=='A' && pGlobal[2]=='S')
{
// Extract number of frames
int range;
sscanf (pGlobal+3, "%d", &range);
if (currMovieData.getNumRecords() < pos+range)
{
currMovieData.insertEmpty(currMovieData.getNumRecords(),pos+range-currMovieData.getNumRecords());
current_markers.update();
}
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')
{
// Detect skipped frames in paste
frame = pGlobal;
if (frame[0]=='+')
{
pos += atoi(frame+1);
while (*frame && *frame != '\n' && *frame!='|')
++frame;
if (*frame=='|') ++frame;
} else
{
++pos;
}
if (!taseditor_config.superimpose_affects_paste || taseditor_config.superimpose == BST_UNCHECKED)
{
currMovieData.records[pos].joysticks[0] = 0;
currMovieData.records[pos].joysticks[1] = 0;
currMovieData.records[pos].joysticks[2] = 0;
currMovieData.records[pos].joysticks[3] = 0;
}
// read this frame input
joy = 0;
new_buttons = 0;
while (*frame && *frame != '\n' && *frame !='\r')
{
switch (*frame)
{
case '|': // Joystick mark
// flush buttons to movie data
if (taseditor_config.superimpose_affects_paste && (taseditor_config.superimpose == BST_CHECKED || (taseditor_config.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
{
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)
{
if (*frame == buttonNames[bit][0])
{
new_buttons |= (1<<bit);
break;
}
}
break;
}
++frame;
}
// before going to next frame, flush buttons to movie data
if (taseditor_config.superimpose_affects_paste && (taseditor_config.superimpose == BST_CHECKED || (taseditor_config.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
{
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))
list.SetHeaderColumnLight(COLUMN_JOYPAD1_A + joy * NUM_JOYPAD_BUTTONS + btn, HEADER_LIGHT_MAX);
}
}
result = true;
}
GlobalUnlock(hGlobal);
}
CloseClipboard();
return result;
}
bool SPLICER::PasteInsert()
{
SelectionFrames* current_selection = selection.MakeStrobe();
if (current_selection->size() == 0) return false;
if (!OpenClipboard(taseditor_window.hwndTasEditor)) return false;
SelectionFrames::iterator current_selection_begin(current_selection->begin());
int num_joypads = joysticks_per_frame[GetInputType(currMovieData)];
bool result = false;
int pos = *current_selection_begin;
HANDLE hGlobal = GetClipboardData(CF_TEXT);
if (hGlobal)
{
char *pGlobal = (char*)GlobalLock((HGLOBAL)hGlobal);
// TAS recording info starts with "TAS "
if (pGlobal[0]=='T' && pGlobal[1]=='A' && pGlobal[2]=='S')
{
// make sure markers have the same size as movie
current_markers.update();
// init inserted_set (for input history hot changes)
selection.GetInsertedSet().clear();
// Extract number of frames
int range;
sscanf (pGlobal+3, "%d", &range);
pGlobal = strchr(pGlobal, '\n');
char* frame;
int joy=0;
std::vector<uint8> flash_joy(num_joypads);
--pos;
while (pGlobal++ && *pGlobal!='\0')
{
// Detect skipped frames in paste
frame = pGlobal;
if (frame[0]=='+')
{
pos += atoi(frame+1);
if (currMovieData.getNumRecords() < pos)
{
currMovieData.insertEmpty(currMovieData.getNumRecords(), pos - currMovieData.getNumRecords());
current_markers.update();
}
while (*frame && *frame != '\n' && *frame != '|')
++frame;
if (*frame=='|') ++frame;
} else
{
++pos;
}
// insert new frame
currMovieData.insertEmpty(pos, 1);
if (taseditor_config.bind_markers) current_markers.insertEmpty(pos, 1);
selection.GetInsertedSet().insert(pos);
// read this frame input
int joy = 0;
while (*frame && *frame != '\n' && *frame !='\r')
{
switch (*frame)
{
case '|': // Joystick mark
++joy;
break;
default:
for (int bit = 0; bit < NUM_JOYPAD_BUTTONS; ++bit)
{
if (*frame == buttonNames[bit][0])
{
currMovieData.records[pos].joysticks[joy] |= (1<<bit);
flash_joy[joy] |= (1<<bit); // highlight buttons
break;
}
}
break;
}
++frame;
}
pGlobal = strchr(pGlobal, '\n');
}
current_markers.update();
if (taseditor_config.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))
list.SetHeaderColumnLight(COLUMN_JOYPAD1_A + joy * NUM_JOYPAD_BUTTONS + btn, HEADER_LIGHT_MAX);
}
}
result = true;
}
GlobalUnlock(hGlobal);
}
CloseClipboard();
return result;
}
// ----------------------------------------------------------------------------------------------
// retrieves some information from clipboard to clipboard_selection
void SPLICER::CheckClipboard()
{
if (OpenClipboard(taseditor_window.hwndTasEditor))
{
// check if clipboard contains TAS Editor input data
HANDLE hGlobal = GetClipboardData(CF_TEXT);
if (hGlobal)
{
clipboard_selection.clear();
int current_pos = -1;
char *pGlobal = (char*)GlobalLock((HGLOBAL)hGlobal);
// TAS recording info starts with "TAS "
if (pGlobal[0]=='T' && pGlobal[1]=='A' && pGlobal[2]=='S')
{
// Extract number of frames
int range;
sscanf (pGlobal+3, "%d", &range);
pGlobal = strchr(pGlobal, '\n');
while (pGlobal++ && *pGlobal!='\0')
{
// Detect skipped frames in paste
char *frame = pGlobal;
if (frame[0]=='+')
{
current_pos += atoi(frame+1);
while (*frame && *frame != '\n' && *frame != '|')
++frame;
if (*frame=='|') ++frame;
} else
current_pos++;
clipboard_selection.insert(current_pos);
// skip input
pGlobal = strchr(pGlobal, '\n');
}
}
GlobalUnlock(hGlobal);
}
CloseClipboard();
}
}
void SPLICER::RedrawTextClipboard()
{
if (clipboard_selection.size())
{
char new_text[100];
strcpy(new_text, clipboardText);
char num[11];
// rows
if (clipboard_selection.size() > 1)
{
_itoa(clipboard_selection.size(), num, 10);
strcat(new_text, num);
strcat(new_text, numTextRows);
} else
{
strcat(new_text, numTextRow);
}
// columns
int columns = NUM_JOYPAD_BUTTONS * joysticks_per_frame[GetInputType(currMovieData)]; // in future the number of columns will depend on selected columns
if (columns > 1)
{
_itoa(columns, num, 10);
strcat(new_text, num);
strcat(new_text, numTextColumns);
} else
{
strcat(new_text, numTextColumn);
}
SetWindowText(hwndTextClipboard, new_text);
} else
SetWindowText(hwndTextClipboard, clipboardEmptyText);
}
SelectionFrames& SPLICER::GetClipboardSelection()
{
return clipboard_selection;
}

View File

@ -0,0 +1,34 @@
//Specification file for SPLICER class
class SPLICER
{
public:
SPLICER();
void init();
void reset();
void update();
void CloneFrames();
void InsertFrames();
void InsertNumFrames();
void DeleteFrames();
void ClearFrames(SelectionFrames* current_selection = 0);
void Truncate();
bool Copy(SelectionFrames* current_selection = 0);
void Cut();
bool Paste();
bool PasteInsert();
void RedrawTextClipboard();
SelectionFrames& GetClipboardSelection();
bool must_redraw_selection_text;
private:
void CheckClipboard();
SelectionFrames clipboard_selection;
HWND hwndTextSelection, hwndTextClipboard;
};

View File

@ -7,6 +7,8 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
// set default values
wndx = 0;
wndy = 0;
wndwidth = 0;
wndheight = 0;
findnote_wndx = 0;
findnote_wndy = 0;
follow_playback = true;
@ -34,7 +36,7 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
greenzone_capacity = GREENZONE_CAPACITY_DEFAULT;
undo_levels = UNDO_LEVELS_DEFAULT;
autosave_period = AUTOSAVE_PERIOD_DEFAULT;
last_export_type = EXPORT_TYPE_1P;
last_export_type = 0; // INPUT_TYPE_1P
last_export_subtitles = false;
savecompact_binary = true;
savecompact_markers = true;
@ -47,6 +49,8 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
findnote_search_up = false;
enable_auto_function = true;
silent_autosave = true;
// empty name
last_author[0] = 0;
}

View File

@ -11,9 +11,7 @@
#define AUTOSAVE_PERIOD_MAX 1440 // 24 hours
#define AUTOSAVE_PERIOD_DEFAULT 15 // in minutes
#define EXPORT_TYPE_1P 0
#define EXPORT_TYPE_2P 1
#define EXPORT_TYPE_FOURSCORE 2
#define AUTHOR_MAX_LEN 100
class TASEDITOR_CONFIG
{
@ -23,6 +21,8 @@ public:
// vars saved in cfg file
int wndx;
int wndy;
int wndwidth;
int wndheight;
int findnote_wndx;
int findnote_wndy;
bool follow_playback;
@ -63,6 +63,7 @@ public:
bool findnote_search_up;
bool enable_auto_function;
bool silent_autosave;
char last_author[AUTHOR_MAX_LEN];
private:

View File

@ -5,6 +5,7 @@
#pragma comment(lib, "UxTheme.lib")
extern int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES];
extern char buttonNames[NUM_JOYPAD_BUTTONS][2];
extern void ColumnSet(int column);
@ -18,6 +19,8 @@ extern INPUT_HISTORY history;
extern MARKERS current_markers;
extern TASEDITOR_SELECTION selection;
extern int GetInputType(MovieData& md);
LRESULT APIENTRY HeaderWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDPROC hwndList_oldWndProc = 0, hwndHeader_oldWndproc = 0;
@ -143,35 +146,12 @@ void TASEDITOR_LIST::init()
ImageList_AddMasked(himglist, bmp, 0xFFFFFF);
DeleteObject(bmp);
ListView_SetImageList(hwndList, himglist, LVSIL_SMALL);
// setup columns
// setup 0th column
LVCOLUMN lvc;
num_columns = 0;
// icons column
lvc.mask = LVCF_WIDTH;
lvc.cx = 13;
ListView_InsertColumn(hwndList, num_columns++, &lvc);
// frame number column
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT;
lvc.fmt = LVCFMT_CENTER;
lvc.cx = 75;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, num_columns++, &lvc);
// pads columns
lvc.cx = 21;
// add pads 1 and 2
for (int joy = 0; joy < 2; ++joy)
{
for (int btn = 0; btn < NUM_JOYPAD_BUTTONS; ++btn)
{
lvc.pszText = buttonNames[btn];
ListView_InsertColumn(hwndList, num_columns++, &lvc);
}
}
// add pads 3 and 4 and frame_number2
if (currMovieData.fourscore) AddFourscore();
reset();
//update();
lvc.cx = COLUMN_ICONS_WIDTH;
ListView_InsertColumn(hwndList, 0, &lvc);
}
void TASEDITOR_LIST::free()
{
@ -210,8 +190,36 @@ void TASEDITOR_LIST::free()
void TASEDITOR_LIST::reset()
{
next_header_update_time = 0;
// scroll to the beginning
ListView_EnsureVisible(hwndList, 0, FALSE);
// delete all columns except 0th
while (ListView_DeleteColumn(hwndList, 1)) {}
// setup columns
LVCOLUMN lvc;
num_columns = 1;
// frame number column
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT;
lvc.fmt = LVCFMT_CENTER;
lvc.cx = COLUMN_FRAMENUM_WIDTH;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, num_columns++, &lvc);
// pads columns
lvc.cx = COLUMN_BUTTON_WIDTH;
int num_joysticks = joysticks_per_frame[GetInputType(currMovieData)];
for (int joy = 0; joy < num_joysticks; ++joy)
{
for (int btn = 0; btn < NUM_JOYPAD_BUTTONS; ++btn)
{
lvc.pszText = buttonNames[btn];
ListView_InsertColumn(hwndList, num_columns++, &lvc);
}
}
// add 2nd frame number column if needed
if (num_columns >= NUM_COLUMNS_NEED_2ND_FRAMENUM)
{
lvc.cx = COLUMN_FRAMENUM_WIDTH;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, num_columns++, &lvc);
}
}
void TASEDITOR_LIST::update()
{
@ -287,6 +295,7 @@ void TASEDITOR_LIST::save(EMUFILE *os, bool really_save)
// returns true if couldn't load
bool TASEDITOR_LIST::load(EMUFILE *is)
{
reset();
update();
// read "LIST" string
char save_id[LIST_ID_LEN];
@ -295,7 +304,8 @@ bool TASEDITOR_LIST::load(EMUFILE *is)
{
// string says to skip loading List
FCEU_printf("No list data in the file\n");
reset();
// scroll to the beginning
ListView_EnsureVisible(hwndList, 0, FALSE);
return false;
}
if (strcmp(list_save_id, save_id)) goto error; // string is not valid
@ -307,41 +317,11 @@ bool TASEDITOR_LIST::load(EMUFILE *is)
return false;
error:
FCEU_printf("Error loading list data\n");
reset();
// scroll to the beginning
ListView_EnsureVisible(hwndList, 0, FALSE);
return true;
}
// ----------------------------------------------------------------------
void TASEDITOR_LIST::AddFourscore()
{
// add list columns
LVCOLUMN lvc;
lvc.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_FMT;
lvc.fmt = LVCFMT_CENTER;
lvc.cx = 21;
for (int joy = 0; joy < 2; ++joy)
{
for (int btn = 0; btn < NUM_JOYPAD_BUTTONS; ++btn)
{
lvc.pszText = buttonNames[btn];
ListView_InsertColumn(hwndList, num_columns++, &lvc);
}
}
// frame number column again
lvc.cx = 75;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, num_columns++, &lvc);
// change eoptions
FCEUI_SetInputFourscore(true);
}
void TASEDITOR_LIST::RemoveFourscore()
{
// remove list columns
for (num_columns = COLUMN_FRAMENUM2; num_columns >= COLUMN_JOYPAD3_A; num_columns--)
ListView_DeleteColumn (hwndList, num_columns);
// change eoptions
FCEUI_SetInputFourscore(false);
}
void TASEDITOR_LIST::RedrawList()
{
InvalidateRect(hwndList, 0, FALSE);
@ -515,7 +495,7 @@ void TASEDITOR_LIST::GetDispInfo(NMLVDISPINFO* nmlvDispInfo)
{
int joy = (item.iSubItem - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
int bit = (item.iSubItem - COLUMN_JOYPAD1_A) % NUM_JOYPAD_BUTTONS;
uint8 data = currMovieData.records[item.iItem].joysticks[joy];
uint8 data = ((int)currMovieData.records.size() > item.iItem) ? currMovieData.records[item.iItem].joysticks[joy] : 0;
if(data & (1<<bit))
{
item.pszText[0] = buttonNames[bit][0];

View File

@ -6,53 +6,64 @@
#define CDDS_SUBITEMPREERASE (CDDS_SUBITEM | CDDS_ITEMPREERASE)
#define CDDS_SUBITEMPOSTERASE (CDDS_SUBITEM | CDDS_ITEMPOSTERASE)
#define NUM_JOYPADS 4
#define MAX_NUM_JOYPADS 4 // = max(joysticks_per_frame[])
#define NUM_JOYPAD_BUTTONS 8
#define HEADER_LIGHT_MAX 10
#define HEADER_LIGHT_HOLD 4
#define HEADER_LIGHT_UPDATE_TICK 40 // 25FPS
#define MAX_NUM_COLUMNS 35
#define COLUMN_ICONS 0
#define COLUMN_FRAMENUM 1
#define COLUMN_JOYPAD1_A 2
#define COLUMN_JOYPAD1_B 3
#define COLUMN_JOYPAD1_S 4
#define COLUMN_JOYPAD1_T 5
#define COLUMN_JOYPAD1_U 6
#define COLUMN_JOYPAD1_D 7
#define COLUMN_JOYPAD1_L 8
#define COLUMN_JOYPAD1_R 9
#define COLUMN_JOYPAD2_A 10
#define COLUMN_JOYPAD2_B 11
#define COLUMN_JOYPAD2_S 12
#define COLUMN_JOYPAD2_T 13
#define COLUMN_JOYPAD2_U 14
#define COLUMN_JOYPAD2_D 15
#define COLUMN_JOYPAD2_L 16
#define COLUMN_JOYPAD2_R 17
#define COLUMN_JOYPAD3_A 18
#define COLUMN_JOYPAD3_B 19
#define COLUMN_JOYPAD3_S 20
#define COLUMN_JOYPAD3_T 21
#define COLUMN_JOYPAD3_U 22
#define COLUMN_JOYPAD3_D 23
#define COLUMN_JOYPAD3_L 24
#define COLUMN_JOYPAD3_R 25
#define COLUMN_JOYPAD4_A 26
#define COLUMN_JOYPAD4_B 27
#define COLUMN_JOYPAD4_S 28
#define COLUMN_JOYPAD4_T 29
#define COLUMN_JOYPAD4_U 30
#define COLUMN_JOYPAD4_D 31
#define COLUMN_JOYPAD4_L 32
#define COLUMN_JOYPAD4_R 33
#define COLUMN_FRAMENUM2 34
enum
{
COLUMN_ICONS,
COLUMN_FRAMENUM,
COLUMN_JOYPAD1_A,
COLUMN_JOYPAD1_B,
COLUMN_JOYPAD1_S,
COLUMN_JOYPAD1_T,
COLUMN_JOYPAD1_U,
COLUMN_JOYPAD1_D,
COLUMN_JOYPAD1_L,
COLUMN_JOYPAD1_R,
COLUMN_JOYPAD2_A,
COLUMN_JOYPAD2_B,
COLUMN_JOYPAD2_S,
COLUMN_JOYPAD2_T,
COLUMN_JOYPAD2_U,
COLUMN_JOYPAD2_D,
COLUMN_JOYPAD2_L,
COLUMN_JOYPAD2_R,
COLUMN_JOYPAD3_A,
COLUMN_JOYPAD3_B,
COLUMN_JOYPAD3_S,
COLUMN_JOYPAD3_T,
COLUMN_JOYPAD3_U,
COLUMN_JOYPAD3_D,
COLUMN_JOYPAD3_L,
COLUMN_JOYPAD3_R,
COLUMN_JOYPAD4_A,
COLUMN_JOYPAD4_B,
COLUMN_JOYPAD4_S,
COLUMN_JOYPAD4_T,
COLUMN_JOYPAD4_U,
COLUMN_JOYPAD4_D,
COLUMN_JOYPAD4_L,
COLUMN_JOYPAD4_R,
COLUMN_FRAMENUM2,
MAX_NUM_COLUMNS
};
// when there's too many button columns, there's need for 2nd Frame# column at the end
#define NUM_COLUMNS_NEED_2ND_FRAMENUM COLUMN_JOYPAD4_R
#define DIGITS_IN_FRAMENUM 7
#define ARROW_IMAGE_ID 20
#define COLUMN_ICONS_WIDTH 13
#define COLUMN_FRAMENUM_WIDTH 75
#define COLUMN_BUTTON_WIDTH 21
// listview colors
#define NORMAL_TEXT_COLOR 0x0
@ -106,9 +117,6 @@ public:
void save(EMUFILE *os, bool really_save = true);
bool load(EMUFILE *is);
void AddFourscore();
void RemoveFourscore();
void RedrawList();
void RedrawRow(int index);
void RedrawHeader();

View File

@ -18,7 +18,7 @@ TASEDITOR_LUA::TASEDITOR_LUA()
void TASEDITOR_LUA::init()
{
hwndRunFunction = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_RUN_MANUAL);
hwndRunFunction = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_RUN_MANUAL);
TaseditorUpdateManualFunctionStatus();
reset();
}
@ -45,13 +45,13 @@ void TASEDITOR_LUA::DisableRunFunction()
// bool taseditor.engaged()
bool TASEDITOR_LUA::engaged()
{
return FCEUMOV_Mode(MOVIEMODE_TASEDIT);
return FCEUMOV_Mode(MOVIEMODE_TASEDITOR);
}
// bool taseditor.markedframe(int frame)
bool TASEDITOR_LUA::markedframe(int frame)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return current_markers.GetMarker(frame) != 0;
else
return false;
@ -60,7 +60,7 @@ bool TASEDITOR_LUA::markedframe(int frame)
// int taseditor.getmarker(int frame)
int TASEDITOR_LUA::getmarker(int frame)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return current_markers.GetMarkerUp(frame);
else
return -1;
@ -69,7 +69,7 @@ int TASEDITOR_LUA::getmarker(int frame)
// int taseditor.setmarker(int frame)
int TASEDITOR_LUA::setmarker(int frame)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
int marker_id = current_markers.GetMarker(frame);
if(!marker_id)
@ -91,7 +91,7 @@ int TASEDITOR_LUA::setmarker(int frame)
// taseditor.clearmarker(int frame)
void TASEDITOR_LUA::clearmarker(int frame)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
if (current_markers.GetMarker(frame))
{
@ -107,7 +107,7 @@ void TASEDITOR_LUA::clearmarker(int frame)
// string taseditor.getnote(int index)
const char* TASEDITOR_LUA::getnote(int index)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return current_markers.GetNote(index).c_str();
else
return NULL;
@ -116,7 +116,7 @@ const char* TASEDITOR_LUA::getnote(int index)
// taseditor.setnote(int index, string newtext)
void TASEDITOR_LUA::setnote(int index, const char* newtext)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
// rename only if newtext is different from old text
char text[MAX_NOTE_LEN];
@ -134,7 +134,7 @@ void TASEDITOR_LUA::setnote(int index, const char* newtext)
// int taseditor.getcurrentbranch()
int TASEDITOR_LUA::getcurrentbranch()
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return bookmarks.GetCurrentBranch();
else
return -1;
@ -143,7 +143,7 @@ int TASEDITOR_LUA::getcurrentbranch()
// string taseditor.getrecordermode()
const char* TASEDITOR_LUA::getrecordermode()
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return recorder.GetRecordingMode();
else
return NULL;
@ -152,7 +152,7 @@ const char* TASEDITOR_LUA::getrecordermode()
// int taseditor.getplaybacktarget()
int TASEDITOR_LUA::getplaybacktarget()
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return playback.pause_frame - 1;
else
return -1;
@ -161,14 +161,14 @@ int TASEDITOR_LUA::getplaybacktarget()
// taseditor.setplayback()
void TASEDITOR_LUA::setplayback(int frame)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
playback.JumpToFrame(frame); // do not trigger lua functions after jump
}
// taseditor.stopseeking()
void TASEDITOR_LUA::stopseeking()
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
playback.SeekingStop();
}

View File

@ -14,10 +14,13 @@ extern RECORDER recorder;
extern INPUT_HISTORY history;
extern TASEDITOR_LIST list;
extern TASEDITOR_SELECTION selection;
extern SPLICER splicer;
extern void FCEU_PrintError(char *format, ...);
extern bool SaveProject();
extern bool SaveProjectAs();
extern int GetInputType(MovieData& md);
extern void SetInputType(MovieData& md, int new_input_type);
TASEDITOR_PROJECT::TASEDITOR_PROJECT()
{
@ -25,17 +28,14 @@ TASEDITOR_PROJECT::TASEDITOR_PROJECT()
void TASEDITOR_PROJECT::init()
{
// init new project
projectFile = "";
projectName = "";
fm2FileName = "";
reset();
}
void TASEDITOR_PROJECT::reset()
{
changed = false;
projectFile = "";
projectName = "";
fm2FileName = "";
}
void TASEDITOR_PROJECT::update()
{
@ -132,6 +132,9 @@ bool TASEDITOR_PROJECT::load(char* fullname)
return false;
}
// ensure that movie has correct set of ports/fourscore
SetInputType(currMovieData, GetInputType(currMovieData));
// load modules
unsigned int saved_stuff;
read32le(&saved_stuff, &ifs);
@ -142,9 +145,10 @@ bool TASEDITOR_PROJECT::load(char* fullname)
list.load(&ifs);
selection.load(&ifs);
// reset other modules
playback.reset();
recorder.reset();
splicer.reset();
popup_display.reset();
reset();
RenameProject(fullname);
@ -180,7 +184,7 @@ void TASEDITOR_PROJECT::SetProjectChanged()
if (!changed)
{
changed = true;
taseditor_window.RedrawCaption();
taseditor_window.UpdateCaption();
SheduleNextAutosave();
}
}

View File

@ -17,6 +17,7 @@ typedef std::set<int> SelectionFrames;
#include "taseditor_list.h"
#include "taseditor_lua.h"
#include "taseditor_sel.h"
#include "splicer.h"
#include "popup_display.h"
#define AUTOSAVE_PERIOD_SCALE 60000 // = 1 minute in milliseconds

View File

@ -1,14 +1,15 @@
//Implementation file of TASEDITOR_SELECTION class
#include "taseditor_project.h"
#include "..\tasedit.h" // only for MARKER_NOTE_EDIT_LOWER
#include "..\taseditor.h" // only for MARKER_NOTE_EDIT_LOWER
extern TASEDITOR_CONFIG taseditor_config;
extern TASEDITOR_WINDOW taseditor_window;
extern MARKERS current_markers;
extern TASEDITOR_LIST list;
extern SPLICER splicer;
extern int marker_note_edit;
extern int joysticks_per_frame[NUM_SUPPORTED_INPUT_TYPES];
extern void UpdateMarkerNote();
LRESULT APIENTRY LowerMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
@ -17,15 +18,6 @@ WNDPROC selectionMarkerEdit_oldWndproc;
// resources
char selection_save_id[SELECTION_ID_LEN] = "SELECTION";
char selection_skipsave_id[SELECTION_ID_LEN] = "SELECTIOX";
char selectionText[] = "Selection: ";
char selectionEmptyText[] = "Selection: no";
char numTextRow[] = "1 row, ";
char numTextRows[] = " rows, ";
char numTextColumn[] = "1 column";
char numTextColumns[] = " columns";
char clipboardText[] = "Clipboard: ";
char clipboardEmptyText[] = "Clipboard: empty";
char lowerMarkerText[] = "Marker ";
TASEDITOR_SELECTION::TASEDITOR_SELECTION()
@ -34,10 +26,8 @@ TASEDITOR_SELECTION::TASEDITOR_SELECTION()
void TASEDITOR_SELECTION::init()
{
hwndPrevMarker = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_PREV_MARKER);
hwndNextMarker = GetDlgItem(taseditor_window.hwndTasEditor, TASEDIT_NEXT_MARKER);
hwndTextSelection = GetDlgItem(taseditor_window.hwndTasEditor, IDC_TEXT_SELECTION);
hwndTextClipboard = GetDlgItem(taseditor_window.hwndTasEditor, IDC_TEXT_CLIPBOARD);
hwndPrevMarker = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_PREV_MARKER);
hwndNextMarker = GetDlgItem(taseditor_window.hwndTasEditor, TASEDITOR_NEXT_MARKER);
hwndSelectionMarker = GetDlgItem(taseditor_window.hwndTasEditor, IDC_SELECTION_MARKER);
SendMessage(hwndSelectionMarker, WM_SETFONT, (WPARAM)list.hMarkersFont, 0);
hwndSelectionMarkerEdit = GetDlgItem(taseditor_window.hwndTasEditor, IDC_SELECTION_MARKER_EDIT);
@ -47,10 +37,6 @@ void TASEDITOR_SELECTION::init()
selectionMarkerEdit_oldWndproc = (WNDPROC)SetWindowLong(hwndSelectionMarkerEdit, GWL_WNDPROC, (LONG)LowerMarkerEditWndProc);
reset();
if (clipboard_selection.empty())
CheckClipboard();
RedrawTextClipboard();
}
void TASEDITOR_SELECTION::free()
{
@ -78,7 +64,6 @@ void TASEDITOR_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 TASEDITOR_SELECTION::update()
@ -125,42 +110,6 @@ void TASEDITOR_SELECTION::update()
}
}
// redraw selection info text of needed
if (must_redraw_text)
{
if (CurrentSelection().size())
{
char new_text[100];
strcpy(new_text, selectionText);
char num[11];
// rows
if (CurrentSelection().size() > 1)
{
_itoa(CurrentSelection().size(), num, 10);
strcat(new_text, num);
strcat(new_text, numTextRows);
} else
{
strcat(new_text, numTextRow);
}
// columns
int columns; // in future the number of columns will depend on selected columns
if (currMovieData.fourscore) columns = 32; else columns = 16;
if (columns > 1)
{
_itoa(columns, num, 10);
strcat(new_text, num);
strcat(new_text, numTextColumns);
} else
{
strcat(new_text, numTextColumn);
}
SetWindowText(hwndTextSelection, new_text);
} else
SetWindowText(hwndTextSelection, selectionEmptyText);
must_redraw_text = false;
}
// track changes of selection beginning
if (last_selection_beginning != GetCurrentSelectionBeginning())
{
@ -179,39 +128,6 @@ void TASEDITOR_SELECTION::update()
}
void TASEDITOR_SELECTION::RedrawTextClipboard()
{
if (clipboard_selection.size())
{
char new_text[100];
strcpy(new_text, clipboardText);
char num[11];
// rows
if (clipboard_selection.size() > 1)
{
_itoa(clipboard_selection.size(), num, 10);
strcat(new_text, num);
strcat(new_text, numTextRows);
} else
{
strcat(new_text, numTextRow);
}
// columns
int columns; // in future the number of columns will depend on selected columns
if (currMovieData.fourscore) columns = 32; else columns = 16;
if (columns > 1)
{
_itoa(columns, num, 10);
strcat(new_text, num);
strcat(new_text, numTextColumns);
} else
{
strcat(new_text, numTextColumn);
}
SetWindowText(hwndTextClipboard, new_text);
} else
SetWindowText(hwndTextClipboard, clipboardEmptyText);
}
void TASEDITOR_SELECTION::RedrawMarker()
{
// redraw marker num
@ -275,7 +191,7 @@ void TASEDITOR_SELECTION::save(EMUFILE *os, bool really_save)
saveSelection(selections_history[(history_start_pos + i) % history_size], os);
}
// write clipboard_selection
saveSelection(clipboard_selection, os);
saveSelection(splicer.GetClipboardSelection(), os);
} else
{
// write "SELECTIOX" string
@ -333,7 +249,7 @@ bool TASEDITOR_SELECTION::load(EMUFILE *is)
if (skiploadSelection(is)) goto error;
// read clipboard_selection
if (loadSelection(clipboard_selection, is)) goto error;
if (loadSelection(splicer.GetClipboardSelection(), is)) goto error;
// all ok
EnforceSelectionToList();
reset_vars();
@ -387,7 +303,7 @@ void TASEDITOR_SELECTION::ItemRangeChanged(NMLVODSTATECHANGE* info)
for(int i = info->iFrom; i <= info->iTo; ++i)
CurrentSelection().erase(i);
must_redraw_text = true;
splicer.must_redraw_selection_text = true;
}
void TASEDITOR_SELECTION::ItemChanged(NMLISTVIEW* info)
{
@ -420,7 +336,7 @@ void TASEDITOR_SELECTION::ItemChanged(NMLISTVIEW* info)
CurrentSelection().erase(item);
}
must_redraw_text = true;
splicer.must_redraw_selection_text = true;
}
// ----------------------------------------------------------
void TASEDITOR_SELECTION::AddNewSelectionToHistory()
@ -465,65 +381,6 @@ void TASEDITOR_SELECTION::redo()
{
jump(history_cursor_pos + 1);
}
void TASEDITOR_SELECTION::MemorizeClipboardSelection()
{
// copy currently strobed selection data to clipboard_selection
clipboard_selection = temp_selection;
RedrawTextClipboard();
}
void TASEDITOR_SELECTION::ReselectClipboard()
{
if (clipboard_selection.size() == 0) return;
ClearSelection();
CurrentSelection() = clipboard_selection;
EnforceSelectionToList();
// also keep selection within list
update();
}
// retrieves some information from clipboard to clipboard_selection
void TASEDITOR_SELECTION::CheckClipboard()
{
if (OpenClipboard(taseditor_window.hwndTasEditor))
{
// check if clipboard contains TAS Editor input data
HANDLE hGlobal = GetClipboardData(CF_TEXT);
if (hGlobal)
{
clipboard_selection.clear();
int current_pos = -1;
char *pGlobal = (char*)GlobalLock((HGLOBAL)hGlobal);
// TAS recording info starts with "TAS "
if (pGlobal[0]=='T' && pGlobal[1]=='A' && pGlobal[2]=='S')
{
// Extract number of frames
int range;
sscanf (pGlobal+3, "%d", &range);
pGlobal = strchr(pGlobal, '\n');
while (pGlobal++ && *pGlobal!='\0')
{
// Detect skipped frames in paste
char *frame = pGlobal;
if (frame[0]=='+')
{
current_pos += atoi(frame+1);
while (*frame && *frame != '\n' && *frame != '|')
++frame;
if (*frame=='|') ++frame;
} else
current_pos++;
clipboard_selection.insert(current_pos);
// skip input
pGlobal = strchr(pGlobal, '\n');
}
}
GlobalUnlock(hGlobal);
}
CloseClipboard();
}
}
// ----------------------------------------------------------
void TASEDITOR_SELECTION::ClearSelection()
{
@ -558,7 +415,7 @@ void TASEDITOR_SELECTION::SetRegionSelection(int start, int end)
for (int i = start; i <= end; ++i)
ListView_SetItemState(list.hwndList, i, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
}
void TASEDITOR_SELECTION::SelectMidMarkers()
void TASEDITOR_SELECTION::SelectBetweenMarkers()
{
int center, upper_border, lower_border;
int upper_marker, lower_marker;
@ -630,6 +487,18 @@ void TASEDITOR_SELECTION::SelectMidMarkers()
}
}
}
void TASEDITOR_SELECTION::ReselectClipboard()
{
SelectionFrames clipboard_selection = splicer.GetClipboardSelection();
if (clipboard_selection.size() == 0) return;
ClearSelection();
CurrentSelection() = clipboard_selection;
EnforceSelectionToList();
// also keep selection within list
update();
}
// getters
int TASEDITOR_SELECTION::GetCurrentSelectionSize()
{
@ -701,7 +570,3 @@ LRESULT APIENTRY LowerMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
return CallWindowProc(selectionMarkerEdit_oldWndproc, hWnd, msg, wParam, lParam);
}

View File

@ -12,7 +12,6 @@ public:
void reset_vars();
void update();
void RedrawTextClipboard();
void RedrawMarker();
void save(EMUFILE *os, bool really_save = true);
@ -30,9 +29,6 @@ public:
void redo();
void jump(int new_pos);
void MemorizeClipboardSelection();
void ReselectClipboard();
void ClearSelection();
void ClearRowSelection(int index);
@ -41,7 +37,8 @@ public:
void SelectAll();
void SetRowSelection(int index);
void SetRegionSelection(int start, int end);
void SelectMidMarkers();
void SelectBetweenMarkers();
void ReselectClipboard();
void JumpPrevMarker();
void JumpNextMarker();
@ -60,16 +57,12 @@ public:
int shown_marker;
HWND hwndPrevMarker, hwndNextMarker;
HWND hwndTextSelection, hwndTextClipboard;
HWND hwndSelectionMarker, hwndSelectionMarkerEdit;
private:
SelectionFrames& CurrentSelection();
void CheckClipboard();
bool track_selection_changes;
bool must_redraw_text;
int last_selection_beginning;
bool old_prev_marker_button_state, prev_marker_button_state;
@ -77,7 +70,6 @@ private:
int button_hold_time;
std::vector<SelectionFrames> selections_history;
SelectionFrames clipboard_selection;
SelectionFrames inserted_set;

View File

@ -2,7 +2,7 @@
#include "taseditor_project.h"
#include "../main.h"
#include "../Win32InputBox.h"
#include "../tasedit.h"
#include "../taseditor.h"
#include <htmlhelp.h>
extern TASEDITOR_CONFIG taseditor_config;
@ -12,6 +12,7 @@ extern RECORDER recorder;
extern TASEDITOR_PROJECT project;
extern TASEDITOR_LIST list;
extern TASEDITOR_SELECTION selection;
extern SPLICER splicer;
extern MARKERS current_markers;
extern BOOKMARKS bookmarks;
extern INPUT_HISTORY history;
@ -36,6 +37,59 @@ const unsigned int MAX_NUMBER_OF_RECENT_PROJECTS = sizeof(recent_projects)/sizeo
// resources
char windowCaptioBase[] = "TAS Editor";
char taseditor_help_filename[] = "\\taseditor.chm";
// all items of the window (used for resising) and their default x,y,w,h
// actual x,y,w,h are calculated at the beginning from screen
static struct
{
int id;
int x;
int y;
int width;
int height;
} window_items[TASEDITOR_WINDOW_TOTAL_ITEMS] = {
IDC_PROGRESS_BUTTON, -1, 0, 0, 0,
IDC_BRANCHES_BUTTON, -1, 0, 0, 0,
IDC_LIST1, 0, 0, -1, -1,
IDC_PLAYBACK_BOX, -1, 0, 0, 0,
IDC_RECORDER_BOX, -1, 0, 0, 0,
IDC_SPLICER_BOX, -1, 0, 0, 0,
IDC_LUA_BOX, -1, 0, 0, 0,
IDC_BOOKMARKS_BOX, -1, 0, 0, 0,
IDC_HISTORY_BOX, -1, 0, 0, -1,
TASEDITOR_REWIND_FULL, -1, 0, 0, 0,
TASEDITOR_REWIND, -1, 0, 0, 0,
TASEDITOR_PLAYSTOP, -1, 0, 0, 0,
TASEDITOR_FORWARD, -1, 0, 0, 0,
TASEDITOR_FORWARD_FULL, -1, 0, 0, 0,
IDC_PROGRESS1, -1, 0, 0, 0,
CHECK_FOLLOW_CURSOR, -1, 0, 0, 0,
CHECK_AUTORESTORE_PLAYBACK, -1, 0, 0, 0,
IDC_BOOKMARKSLIST, -1, 0, 0, 0,
IDC_HISTORYLIST, -1, 0, 0, -1,
IDC_RADIO_ALL, -1, 0, 0, 0,
IDC_RADIO_1P, -1, 0, 0, 0,
IDC_RADIO_2P, -1, 0, 0, 0,
IDC_RADIO_3P, -1, 0, 0, 0,
IDC_RADIO_4P, -1, 0, 0, 0,
IDC_SUPERIMPOSE, -1, 0, 0, 0,
TASEDITOR_PREV_MARKER, -1, -1, 0, -1,
TASEDITOR_FIND_BEST_SIMILAR_MARKER, -1, -1, 0, -1,
TASEDITOR_FIND_NEXT_SIMILAR_MARKER, -1, -1, 0, -1,
TASEDITOR_NEXT_MARKER, -1, -1, 0, -1,
IDC_JUMP_PLAYBACK_BUTTON, 0, 0, 0, 0,
IDC_PLAYBACK_MARKER_EDIT, 0, 0, -1, 0,
IDC_PLAYBACK_MARKER, 0, 0, 0, 0,
IDC_JUMP_SELECTION_BUTTON, 0, -1, 0, -1,
IDC_SELECTION_MARKER_EDIT, 0, -1, -1, -1,
IDC_SELECTION_MARKER, 0, -1, 0, -1,
IDC_BRANCHES_BITMAP, -1, 0, 0, 0,
CHECK_TURBO_SEEK, -1, 0, 0, 0,
IDC_TEXT_SELECTION, -1, 0, 0, 0,
IDC_TEXT_CLIPBOARD, -1, 0, 0, 0,
IDC_RECORDING, -1, 0, 0, 0,
TASEDITOR_RUN_MANUAL, -1, 0, 0, 0,
IDC_RUN_AUTO, -1, 0, 0, 0,
};
TASEDITOR_WINDOW::TASEDITOR_WINDOW()
{
@ -43,18 +97,27 @@ TASEDITOR_WINDOW::TASEDITOR_WINDOW()
hwndFindNote = 0;
hTaseditorIcon = 0;
TASEditor_focus = false;
ready_for_resizing = false;
min_width = 0;
min_height = 0;
}
void TASEDITOR_WINDOW::init()
{
ready_for_resizing = false;
hTaseditorIcon = (HICON)LoadImage(fceu_hInstance, MAKEINTRESOURCE(IDI_ICON3), IMAGE_ICON, 16, 16, LR_DEFAULTSIZE);
hwndTasEditor = CreateDialog(fceu_hInstance, "TASEDIT", hAppWnd, WndprocTasEditor);
hwndTasEditor = CreateDialog(fceu_hInstance, "TASEDITOR", hAppWnd, WndprocTasEditor);
CalculateItems();
// restore position and size from config, also bring the window on top
//RECT desiredRect = {0, 0, taseditor_config.wndwidth, taseditor_config.wndheight};
//AdjustWindowRectEx(&desiredRect, GetWindowLong(hwndTasEditor, GWL_STYLE), true, GetWindowLong(hwndTasEditor, GWL_EXSTYLE));
SetWindowPos(hwndTasEditor, HWND_TOP, taseditor_config.wndx, taseditor_config.wndy, taseditor_config.wndwidth, taseditor_config.wndheight, SWP_NOOWNERZORDER);
hmenu = GetMenu(hwndTasEditor);
hrmenu = LoadMenu(fceu_hInstance,"TASEDITCONTEXTMENUS");
hrmenu = LoadMenu(fceu_hInstance,"TASEDITORCONTEXTMENUS");
UpdateCheckedItems();
SetWindowPos(hwndTasEditor, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
recent_projects_menu = CreateMenu();
UpdateRecentProjectsMenu();
@ -89,7 +152,114 @@ void TASEDITOR_WINDOW::update()
}
// --------------------------------------------------------------------------------
void TASEDITOR_WINDOW::RedrawCaption()
void TASEDITOR_WINDOW::CalculateItems()
{
RECT r, main_r;
POINT p;
HWND hCtrl;
// set min size to current size
GetWindowRect(hwndTasEditor, &main_r);
min_width = main_r.right - main_r.left;
min_height = main_r.bottom - main_r.top;
// check if wndwidth and wndheight weren't initialized
if (taseditor_config.wndwidth < min_width)
taseditor_config.wndwidth = min_width;
if (taseditor_config.wndheight < min_height)
taseditor_config.wndheight = min_height;
// find current client area of Taseditor window
int main_width = main_r.right - main_r.left;
int main_height = main_r.bottom - main_r.top;
// calculate current positions for all items
for (int i = 0; i < TASEDITOR_WINDOW_TOTAL_ITEMS; ++i)
{
hCtrl = GetDlgItem(hwndTasEditor, window_items[i].id);
GetWindowRect(hCtrl, &r);
p.x = r.left;
p.y = r.top;
ScreenToClient(hwndTasEditor, &p);
if (window_items[i].x < 0)
// right-aligned
window_items[i].x = -(main_width - p.x);
else
// left-aligned
window_items[i].x = p.x;
if (window_items[i].y < 0)
// bottom-aligned
window_items[i].y = -(main_height - p.y);
else
// top-aligned
window_items[i].y = p.y;
if (window_items[i].width < 0)
// width is right-aligned (may be dynamic width)
window_items[i].width = -(main_width - (p.x + (r.right - r.left)));
else
// normal width
window_items[i].width = r.right - r.left;
if (window_items[i].height < 0)
// height is bottom-aligned (may be dynamic height)
window_items[i].height = -(main_height - (p.y + (r.bottom - r.top)));
else
// normal height
window_items[i].height = r.bottom - r.top;
}
ready_for_resizing = true;
}
void TASEDITOR_WINDOW::ResizeItems()
{
HWND hCtrl;
int x, y, width, height;
for (int i = 0; i < TASEDITOR_WINDOW_TOTAL_ITEMS; ++i)
{
hCtrl = GetDlgItem(hwndTasEditor, window_items[i].id);
if (window_items[i].x < 0)
// right-aligned
x = taseditor_config.wndwidth + window_items[i].x;
else
// left-aligned
x = window_items[i].x;
if (window_items[i].y < 0)
// bottom-aligned
y = taseditor_config.wndheight + window_items[i].y;
else
// top-aligned
y = window_items[i].y;
if (window_items[i].width < 0)
// width is right-aligned (may be dynamic width)
width = (taseditor_config.wndwidth + window_items[i].width) - x;
else
// normal width
width = window_items[i].width;
if (window_items[i].height < 0)
// height is bottom-aligned (may be dynamic height)
height = (taseditor_config.wndheight + window_items[i].height) - y;
else
// normal height
height = window_items[i].height;
SetWindowPos(hCtrl, 0, x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOREDRAW);
}
RedrawTaseditor();
//RedrawWindow(hwndTasEditor, NULL, NULL, RDW_INVALIDATE);
}
void TASEDITOR_WINDOW::WindowMovedOrResized()
{
RECT wrect;
GetWindowRect(hwndTasEditor, &wrect);
taseditor_config.wndx = wrect.left;
taseditor_config.wndy = wrect.top;
WindowBoundsCheckNoResize(taseditor_config.wndx, taseditor_config.wndy, wrect.right);
taseditor_config.wndwidth = wrect.right - wrect.left;
if (taseditor_config.wndwidth < min_width)
taseditor_config.wndwidth = min_width;
taseditor_config.wndheight = wrect.bottom - wrect.top;
if (taseditor_config.wndheight < min_height)
taseditor_config.wndheight = min_height;
}
void TASEDITOR_WINDOW::UpdateCaption()
{
char new_caption[300];
strcpy(new_caption, windowCaptioBase);
@ -107,7 +277,7 @@ void TASEDITOR_WINDOW::RedrawCaption()
strcat(new_caption, "*");
SetWindowText(hwndTasEditor, new_caption);
}
void TASEDITOR_WINDOW::RedrawWindow()
void TASEDITOR_WINDOW::RedrawTaseditor()
{
InvalidateRect(hwndTasEditor, 0, FALSE);
}
@ -201,10 +371,10 @@ void TASEDITOR_WINDOW::UpdateRecentProjectsMenu()
int x;
moo.cbSize = sizeof(moo);
moo.fMask = MIIM_SUBMENU | MIIM_STATE;
GetMenuItemInfo(GetSubMenu(hmenu, 0), ID_TASEDIT_FILE_RECENT, FALSE, &moo);
GetMenuItemInfo(GetSubMenu(hmenu, 0), ID_FILE_RECENT, FALSE, &moo);
moo.hSubMenu = recent_projects_menu;
moo.fState = recent_projects[0] ? MFS_ENABLED : MFS_GRAYED;
SetMenuItemInfo(GetSubMenu(hmenu, 0), ID_TASEDIT_FILE_RECENT, FALSE, &moo);
SetMenuItemInfo(GetSubMenu(hmenu, 0), ID_FILE_RECENT, FALSE, &moo);
// Remove all recent files submenus
for(x = 0; x < MAX_NUMBER_OF_RECENT_PROJECTS; x++)
@ -237,9 +407,9 @@ void TASEDITOR_WINDOW::UpdateRecentProjectsMenu()
for (i = 0; i < MAX_NUMBER_OF_RECENT_PROJECTS; ++i)
if (recent_projects[i]) break;
if (i < MAX_NUMBER_OF_RECENT_PROJECTS)
EnableMenuItem(hmenu, ID_TASEDIT_FILE_RECENT, MF_ENABLED);
EnableMenuItem(hmenu, ID_FILE_RECENT, MF_ENABLED);
else
EnableMenuItem(hmenu, ID_TASEDIT_FILE_RECENT, MF_GRAYED);
EnableMenuItem(hmenu, ID_FILE_RECENT, MF_GRAYED);
DrawMenuBar(hwndTasEditor);
}
@ -324,21 +494,39 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
if (taseditor_config.wndx == -32000) taseditor_config.wndx = 0; //Just in case
if (taseditor_config.wndy == -32000) taseditor_config.wndy = 0;
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)taseditor_window.hTaseditorIcon);
SetWindowPos(hwndDlg, 0, taseditor_config.wndx, taseditor_config.wndy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
break;
}
case WM_MOVE:
case WM_WINDOWPOSCHANGED:
{
WINDOWPOS* windowpos = (WINDOWPOS*)lParam;
if (!(windowpos->flags & SWP_NOSIZE))
{
// window was resized
if (!IsIconic(hwndDlg))
{
RECT wrect;
GetWindowRect(hwndDlg, &wrect);
taseditor_config.wndx = wrect.left;
taseditor_config.wndy = wrect.top;
WindowBoundsCheckNoResize(taseditor_config.wndx, taseditor_config.wndy, wrect.right);
// also move popup display if it's open
taseditor_window.WindowMovedOrResized();
if (taseditor_window.ready_for_resizing)
taseditor_window.ResizeItems();
// also change coordinates of popup display (and move if it's open)
popup_display.ParentWindowMoved();
}
} else if (!(windowpos->flags & SWP_NOMOVE))
{
// window was moved
if (!IsIconic(hwndDlg) && !IsZoomed(hwndDlg))
taseditor_window.WindowMovedOrResized();
// also change coordinates of popup display (and move if it's open)
popup_display.ParentWindowMoved();
}
break;
}
case WM_GETMINMAXINFO:
{
if (taseditor_window.ready_for_resizing)
{
((MINMAXINFO*)lParam)->ptMinTrackSize.x = taseditor_window.min_width;
((MINMAXINFO*)lParam)->ptMinTrackSize.y = taseditor_window.min_height;
}
break;
}
case WM_NOTIFY:
@ -413,7 +601,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
break;
}
break;
case TASEDIT_PLAYSTOP:
case TASEDITOR_PLAYSTOP:
switch(((LPNMHDR)lParam)->code)
{
case NM_CLICK:
@ -426,7 +614,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case WM_CLOSE:
case WM_QUIT:
ExitTasEdit();
ExitTasEditor();
break;
case WM_ACTIVATE:
if(LOWORD(wParam))
@ -529,6 +717,9 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
}
break;
}
case ID_FILE_NEW:
NewProject();
break;
case ID_FILE_OPENPROJECT:
OpenProject();
break;
@ -548,8 +739,8 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_FILE_EXPORTFM2:
Export();
break;
case ID_TASEDIT_FILE_CLOSE:
ExitTasEdit();
case ID_FILE_CLOSE:
ExitTasEditor();
break;
case ID_EDIT_SELECTALL:
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
@ -560,31 +751,31 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
selection.SelectAll();
break;
case ACCEL_CTRL_X:
case ID_TASEDIT_CUT:
case ID_EDIT_CUT:
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
SendMessage(playback.hwndPlaybackMarkerEdit, WM_CUT, 0, 0);
else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
SendMessage(selection.hwndSelectionMarkerEdit, WM_CUT, 0, 0);
else
Cut();
splicer.Cut();
break;
case ACCEL_CTRL_C:
case ID_TASEDIT_COPY:
case ID_EDIT_COPY:
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
SendMessage(playback.hwndPlaybackMarkerEdit, WM_COPY, 0, 0);
else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
SendMessage(selection.hwndSelectionMarkerEdit, WM_COPY, 0, 0);
else
Copy();
splicer.Copy();
break;
case ACCEL_CTRL_V:
case ID_TASEDIT_PASTE:
case ID_EDIT_PASTE:
if (marker_note_edit == MARKER_NOTE_EDIT_UPPER)
SendMessage(playback.hwndPlaybackMarkerEdit, WM_PASTE, 0, 0);
else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
SendMessage(selection.hwndSelectionMarkerEdit, WM_PASTE, 0, 0);
else
Paste();
splicer.Paste();
break;
case ACCEL_SHIFT_V:
{
@ -604,7 +795,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
else
SendMessage(selection.hwndSelectionMarkerEdit, EM_REPLACESEL, true, (LPARAM)insert_V);
} else
PasteInsert();
splicer.PasteInsert();
break;
}
case ID_EDIT_PASTEINSERT:
@ -613,18 +804,18 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
SendMessage(selection.hwndSelectionMarkerEdit, WM_PASTE, 0, 0);
else
PasteInsert();
splicer.PasteInsert();
break;
case ACCEL_CTRL_DELETE:
case ID_TASEDIT_DELETE:
case ID_EDIT_DELETE:
case ID_CONTEXT_SELECTED_DELETEFRAMES:
DeleteFrames();
splicer.DeleteFrames();
break;
case ACCEL_CTRL_T:
case ID_EDIT_TRUNCATE:
case ID_CONTEXT_SELECTED_TRUNCATE:
case ID_CONTEXT_STRAY_TRUNCATE:
Truncate();
splicer.Truncate();
break;
case ID_HELP_TASEDITHELP:
{
@ -638,12 +829,12 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_EDIT_INSERT:
case MENU_CONTEXT_STRAY_INSERTFRAMES:
case ID_CONTEXT_SELECTED_INSERTFRAMES2:
InsertNumFrames();
splicer.InsertNumFrames();
break;
case ACCEL_SHIFT_INS:
case ID_EDIT_INSERTFRAMES:
case ID_CONTEXT_SELECTED_INSERTFRAMES:
InsertFrames();
splicer.InsertFrames();
break;
case ACCEL_DEL:
case ID_EDIT_CLEAR:
@ -663,9 +854,9 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
SendMessage(selection.hwndSelectionMarkerEdit, EM_SETSEL, sel_start, sel_start + 1);
SendMessage(selection.hwndSelectionMarkerEdit, WM_CLEAR, 0, 0);
} else
ClearFrames();
splicer.ClearFrames();
break;
case TASEDIT_PLAYSTOP:
case TASEDITOR_PLAYSTOP:
playback.ToggleEmulationPause();
break;
case CHECK_FOLLOW_CURSOR:
@ -718,7 +909,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
taseditor_config.follow_note_context ^= 1;
taseditor_window.UpdateCheckedItems();
break;
case ACCEL_CTRL_P:
case CHECK_AUTORESTORE_PLAYBACK:
//switch "Auto-restore last playback position" flag
taseditor_config.restore_position ^= 1;
@ -874,16 +1064,16 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
else if (marker_note_edit == MARKER_NOTE_EDIT_LOWER)
SendMessage(selection.hwndSelectionMarkerEdit, EM_SETSEL, 0, -1);
else
selection.SelectMidMarkers();
selection.SelectBetweenMarkers();
break;
case ID_EDIT_SELECTMIDMARKERS:
case ID_SELECTED_SELECTMIDMARKERS:
selection.SelectMidMarkers();
selection.SelectBetweenMarkers();
break;
case ACCEL_CTRL_INSERT:
case ID_EDIT_CLONEFRAMES:
case ID_SELECTED_CLONE:
CloneFrames();
splicer.CloneFrames();
break;
case ACCEL_CTRL_Z:
case ID_EDIT_UNDO:
@ -1021,22 +1211,22 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
if (taseditor_window.hwndFindNote)
SetFocus(GetDlgItem(taseditor_window.hwndFindNote, IDC_NOTE_TO_FIND));
else
taseditor_window.hwndFindNote = CreateDialog(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDIT_FINDNOTE), taseditor_window.hwndTasEditor, FindNoteProc);
taseditor_window.hwndFindNote = CreateDialog(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_FINDNOTE), taseditor_window.hwndTasEditor, FindNoteProc);
break;
}
case TASEDIT_FIND_BEST_SIMILAR_MARKER:
case TASEDITOR_FIND_BEST_SIMILAR_MARKER:
search_similar_marker = 0;
current_markers.FindSimilar(search_similar_marker);
search_similar_marker++;
break;
case TASEDIT_FIND_NEXT_SIMILAR_MARKER:
case TASEDITOR_FIND_NEXT_SIMILAR_MARKER:
current_markers.FindSimilar(search_similar_marker);
search_similar_marker++;
break;
case ID_HELP_ABOUT:
DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDIT_ABOUT), taseditor_window.hwndTasEditor, AboutProc);
DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_ABOUT), taseditor_window.hwndTasEditor, AboutProc);
break;
case TASEDIT_RUN_MANUAL:
case TASEDITOR_RUN_MANUAL:
// the function will be called in next window update
must_call_manual_lua_function = true;
break;

View File

@ -1,4 +1,5 @@
//Specification file for TASEDITOR_WINDOW class
#define TASEDITOR_WINDOW_TOTAL_ITEMS 42
enum ECONTEXTMENU
{
@ -15,13 +16,13 @@ public:
void reset();
void update();
HWND hwndTasEditor, hwndFindNote;
HMENU hmenu, hrmenu;
HICON hTaseditorIcon;
bool TASEditor_focus;
void CalculateItems();
void ResizeItems();
void RedrawCaption();
void RedrawWindow();
void WindowMovedOrResized();
void UpdateCaption();
void RedrawTaseditor();
void RightClick(LPNMITEMACTIVATE info);
void StrayClickMenu(LPNMITEMACTIVATE info);
@ -34,6 +35,13 @@ public:
void RemoveRecentProject(unsigned int which);
void LoadRecentProject(int slot);
HWND hwndTasEditor, hwndFindNote;
HMENU hmenu, hrmenu;
HICON hTaseditorIcon;
bool TASEditor_focus;
bool ready_for_resizing;
int min_width;
int min_height;
private:

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,43 @@
#define MARKER_NOTE_EDIT_NONE 0
#define MARKER_NOTE_EDIT_UPPER 1
#define MARKER_NOTE_EDIT_LOWER 2
enum
{
MARKER_NOTE_EDIT_NONE,
MARKER_NOTE_EDIT_UPPER,
MARKER_NOTE_EDIT_LOWER
};
struct NewProjectParameters
{
int input_type;
bool copy_current_input;
bool copy_current_markers;
std::wstring author_name;
};
void SingleClick(LPNMITEMACTIVATE info);
void DoubleClick(LPNMITEMACTIVATE info);
bool EnterTasEdit();
void InitDialog();
bool ExitTasEdit();
void UpdateTasEdit();
void ToggleJoypadBit(int column_index, int row_index, UINT KeyFlags);
void ColumnSet(int column);
void InputColumnSet(int column);
void FrameColumnSet();
bool EnterTasEditor();
bool ExitTasEditor();
void UpdateTasEditor();
void NewProject();
void OpenProject();
bool LoadProject(char* fullname);
bool SaveProject();
bool SaveProjectAs();
void SaveCompact();
bool AskSaveProject();
void Import();
void Export();
void CloneFrames();
void InsertFrames();
void InsertNumFrames();
void DeleteFrames();
void ClearFrames(SelectionFrames* current_selection = 0);
void Truncate();
void ColumnSet(int column);
void InputColumnSet(int column);
void FrameColumnSet();
bool Copy(SelectionFrames* current_selection = 0);
void Cut();
bool Paste();
bool PasteInsert();
int GetInputType(MovieData& md);
void SetInputType(MovieData& md, int new_input_type);
void SetTaseditInput();
void ClearTaseditInput();

View File

@ -1498,10 +1498,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
if (GameInfo && !(fileDropped.find(".fm3") == string::npos))
{
//.fm3 is at the end of the filename so that must be the extension
extern bool EnterTasEdit();
extern bool EnterTasEditor();
extern bool LoadProject(char* fullname);
extern bool AskSaveProject();
if (EnterTasEdit()) //We are convinced it is a TAS Editor project file, attempt to load in TAS Editor
if (EnterTasEditor()) //We are convinced it is a TAS Editor project file, attempt to load in TAS Editor
if (AskSaveProject()) // in case there's unsaved project
LoadProject(ftmp);
}
@ -1943,9 +1943,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
// DoByteMonitor();
// break;
// Removing this tool since it is redundant to both
case MENU_TASEDIT:
extern bool EnterTasEdit();
EnterTasEdit();
case MENU_TASEDITOR:
extern bool EnterTasEditor();
EnterTasEditor();
break;
case MENU_CONVERT_MOVIE:
ConvertFCM(hWnd);
@ -2275,7 +2275,7 @@ adelikat: Outsourced this to a remappable hotkey
UpdateMenuHotkeys();
EnableMenuItem(fceumenu,MENU_RESET,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_RESET)?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_POWER,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_POWER)?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_TASEDIT,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_TASEDIT)?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_TASEDITOR,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_TASEDITOR)?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_CLOSE_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_CLOSEGAME) && GameInfo ?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_RECENT_FILES,MF_BYCOMMAND | ((FCEU_IsValidUI(FCEUI_OPENGAME) && HasRecentFiles()) ?MF_ENABLED:MF_GRAYED)); //adelikat - added && recent_files, otherwise this line prevents recent from ever being gray when TAS Editor is not engaged
EnableMenuItem(fceumenu,MENU_OPEN_FILE,MF_BYCOMMAND | (FCEU_IsValidUI(FCEUI_OPENGAME)?MF_ENABLED:MF_GRAYED));
@ -2294,7 +2294,7 @@ adelikat: Outsourced this to a remappable hotkey
EnableMenuItem(fceumenu,MENU_STOP_AVI,MF_BYCOMMAND | (FCEUI_AviIsRecording()?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,MENU_STOP_WAV,MF_BYCOMMAND | (loggingSound?MF_ENABLED:MF_GRAYED));
EnableMenuItem(fceumenu,ID_FILE_CLOSELUAWINDOWS,MF_BYCOMMAND | (LuaConsoleHWnd?MF_ENABLED:MF_GRAYED));
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
EnableMenuItem(fceumenu, MENU_PAL, false);
EnableMenuItem(fceumenu, ID_NEWPPU, false);
@ -2862,9 +2862,9 @@ void UpdateMenuHotkeys()
ChangeMenuItemText(MENU_MEMORY_WATCH, combined);
//Open TAS Editor
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_OPENTASEDIT]);
combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_OPENTASEDITOR]);
combined = "&TAS Editor...\t" + combo;
ChangeMenuItemText(MENU_TASEDIT, combined);
ChangeMenuItemText(MENU_TASEDITOR, combined);
//-------------------------------Debug--------------------------------------
//Open Debugger

View File

@ -720,7 +720,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
ProcessSubtitles();
#ifdef WIN32
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
greenzone.TryDumpIncremental(lagFlag != 0);
#endif
}
@ -984,7 +984,7 @@ void UpdateAutosave(void)
void FCEUI_Autosave(void)
{
if(!EnableAutosave || !AutoSS || FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if(!EnableAutosave || !AutoSS || FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
return;
if(AutosaveStatus[AutosaveIndex] == 1)
@ -1020,7 +1020,7 @@ bool FCEU_IsValidUI(EFCEUI ui)
{
case FCEUI_OPENGAME:
case FCEUI_CLOSEGAME:
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) return false;
break;
case FCEUI_RECORDMOVIE:
case FCEUI_PLAYMOVIE:
@ -1032,7 +1032,7 @@ bool FCEU_IsValidUI(EFCEUI ui)
case FCEUI_PREVIOUSSAVESTATE:
case FCEUI_VIEWSLOTS:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) return false;
break;
case FCEUI_STOPMOVIE:
@ -1042,14 +1042,14 @@ bool FCEU_IsValidUI(EFCEUI ui)
case FCEUI_STOPAVI:
return FCEUI_AviIsRecording();
case FCEUI_TASEDIT:
case FCEUI_TASEDITOR:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDIT)) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) return false;
break;
case FCEUI_RESET:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_FINISHED|MOVIEMODE_TASEDIT|MOVIEMODE_PLAY)) return false;
if(FCEUMOV_Mode(MOVIEMODE_FINISHED|MOVIEMODE_TASEDITOR|MOVIEMODE_PLAY)) return false;
break;
case FCEUI_POWER:

View File

@ -629,7 +629,7 @@ static void CommandUsePreset(void);
static void BackgroundDisplayToggle(void);
static void ObjectDisplayToggle(void);
static void ViewSlots(void);
static void LaunchTasEdit(void);
static void LaunchTasEditor(void);
static void LaunchMemoryWatch(void);
static void LaunchCheats(void);
static void LaunchDebugger(void);
@ -654,78 +654,78 @@ static void MovieSubtitleToggle(void);
static void UndoRedoSavestate(void);
static void FCEUI_DoExit(void);
static void ToggleFullscreen(void);
static void TaseditRewindOn(void);
static void TaseditRewindOff(void);
static void TaseditorRewindOn(void);
static void TaseditorRewindOff(void);
struct EMUCMDTABLE FCEUI_CommandTable[]=
{
{ EMUCMD_POWER, EMUCMDTYPE_MISC, FCEUI_PowerNES, 0, 0, "Power", 0 },
{ EMUCMD_RESET, EMUCMDTYPE_MISC, FCEUI_ResetNES, 0, 0, "Reset", 0 },
{ EMUCMD_PAUSE, EMUCMDTYPE_MISC, FCEUI_ToggleEmulationPause, 0, 0, "Pause", EMUCMDFLAG_TASEDIT },
{ EMUCMD_FRAME_ADVANCE, EMUCMDTYPE_MISC, FCEUI_FrameAdvance, FCEUI_FrameAdvanceEnd, 0, "Frame Advance", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDIT },
{ EMUCMD_PAUSE, EMUCMDTYPE_MISC, FCEUI_ToggleEmulationPause, 0, 0, "Pause", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_FRAME_ADVANCE, EMUCMDTYPE_MISC, FCEUI_FrameAdvance, FCEUI_FrameAdvanceEnd, 0, "Frame Advance", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_HIDE_MENU_TOGGLE, EMUCMDTYPE_MISC, FCEUD_HideMenuToggle, 0, 0, "Hide Menu Toggle", 0 },
{ EMUCMD_EXIT, EMUCMDTYPE_MISC, FCEUI_DoExit, 0, 0, "Exit", 0},
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_NORMAL, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Normal Speed", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_FASTER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Up", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_NORMAL, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Normal Speed", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_FASTER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Up", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_FASTEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Fastest Speed", 0 },
{ EMUCMD_SPEED_TURBO, EMUCMDTYPE_SPEED, FCEUD_TurboOn, FCEUD_TurboOff, 0, "Turbo", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_TURBO_TOGGLE, EMUCMDTYPE_SPEED, FCEUD_TurboToggle, 0, 0, "Turbo Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_TURBO, EMUCMDTYPE_SPEED, FCEUD_TurboOn, FCEUD_TurboOff, 0, "Turbo", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_TURBO_TOGGLE, EMUCMDTYPE_SPEED, FCEUD_TurboToggle, 0, 0, "Turbo Toggle", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_0, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 0", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_1, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 1", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_2, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 2", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_3, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 3", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_4, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 4", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_5, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 5", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_6, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 6", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_7, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 7", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_8, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 8", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_9, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 9", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_SLOT_0, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 0", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_1, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 1", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_2, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 2", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_3, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 3", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_4, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 4", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_5, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 5", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_6, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 6", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_7, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 7", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_8, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 8", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_9, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_NEXT, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Next Savestate Slot", 0 },
{ EMUCMD_SAVE_SLOT_PREV, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Previous Savestate Slot", 0 },
{ EMUCMD_SAVE_STATE, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State", 0 },
{ EMUCMD_SAVE_STATE_AS, EMUCMDTYPE_STATE, FCEUD_SaveStateAs, 0, 0, "Save State As...", 0 },
{ EMUCMD_SAVE_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 0", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 1", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_2, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 2", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_3, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 3", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_4, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 4", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_5, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 5", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_6, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 6", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 7", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 8", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 9", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SAVE_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 0", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 1", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_2, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 2", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_3, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 3", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_4, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 4", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_5, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 5", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_6, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 6", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 7", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 8", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State", 0 },
{ EMUCMD_LOAD_STATE_FROM, EMUCMDTYPE_STATE, FCEUD_LoadStateFrom, 0, 0, "Load State From...", 0 },
{ EMUCMD_LOAD_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 0", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 1", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_2, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 2", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_3, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 3", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_4, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 4", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_5, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 5", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_6, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 6", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 7", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 8", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 9", EMUCMDFLAG_TASEDIT },
{ EMUCMD_LOAD_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 0", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 1", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_2, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 2", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_3, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 3", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_4, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 4", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_5, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 5", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_6, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 6", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 7", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 8", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_RECORD_TO, EMUCMDTYPE_MOVIE, FCEUD_MovieRecordTo, 0, 0, "Record Movie To...", 0 },
{ EMUCMD_MOVIE_REPLAY_FROM, EMUCMDTYPE_MOVIE, FCEUD_MovieReplayFrom, 0, 0, "Play Movie From...", 0 },
{ EMUCMD_MOVIE_PLAY_FROM_BEGINNING, EMUCMDTYPE_MOVIE, FCEUI_MoviePlayFromBeginning, 0, 0, "Play Movie From Beginning", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_PLAY_FROM_BEGINNING, EMUCMDTYPE_MOVIE, FCEUI_MoviePlayFromBeginning, 0, 0, "Play Movie From Beginning", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_STOP, EMUCMDTYPE_MOVIE, FCEUI_StopMovie, 0, 0, "Stop Movie", 0 },
{ EMUCMD_MOVIE_READONLY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleReadOnly, 0, 0, "Toggle Read-Only", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Toggle Frame Display", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_READONLY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleReadOnly, 0, 0, "Toggle Read-Only", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Toggle Frame Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_ToggleInputDisplay, 0, 0, "Toggle Input Display", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUD_ToggleStatusIcon, 0, 0, "Toggle Status Icon", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_ToggleInputDisplay, 0, 0, "Toggle Input Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUD_ToggleStatusIcon, 0, 0, "Toggle Status Icon", EMUCMDFLAG_TASEDITOR },
#ifdef _S9XLUA_H
{ EMUCMD_SCRIPT_RELOAD, EMUCMDTYPE_MISC, FCEU_ReloadLuaCode, 0, 0, "Reload current Lua script", 0 },
#endif
{ EMUCMD_SOUND_TOGGLE, EMUCMDTYPE_SOUND, FCEUD_SoundToggle, 0, 0, "Sound Mute Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SOUND_TOGGLE, EMUCMDTYPE_SOUND, FCEUD_SoundToggle, 0, 0, "Sound Mute Toggle", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SOUND_VOLUME_UP, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Up", 0 },
{ EMUCMD_SOUND_VOLUME_DOWN, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Down", 0 },
{ EMUCMD_SOUND_VOLUME_NORMAL, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Normal", 0 },
@ -749,14 +749,14 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_VSUNI_TOGGLE_DIP_9, EMUCMDTYPE_VSUNI, CommandToggleDip, 0, 0, "Toggle Dipswitch 9", 0 },
{ EMUCMD_MISC_AUTOSAVE, EMUCMDTYPE_MISC, FCEUI_Autosave, 0, 0, "Load Last Auto-save", 0},
{ EMUCMD_MISC_SHOWSTATES, EMUCMDTYPE_MISC, ViewSlots, 0, 0, "View save slots", 0 },
{ EMUCMD_MISC_USE_INPUT_PRESET_1, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 1", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_USE_INPUT_PRESET_2, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 2", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_USE_INPUT_PRESET_1, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 1", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_USE_INPUT_PRESET_2, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 2", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background Display", 0 },
{ EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMDTYPE_MISC, ObjectDisplayToggle, 0, 0, "Toggle Object Display", 0 },
{ EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,EMUCMDTYPE_MISC, LagCounterToggle, 0, 0, "Lag Counter Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_OPENTASEDIT, EMUCMDTYPE_TOOL, LaunchTasEdit, 0, 0, "Open TAS Editor", 0},
{ EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch,0, 0, "Open Memory Watch", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,EMUCMDTYPE_MISC, LagCounterToggle, 0, 0, "Lag Counter Toggle", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_OPENTASEDITOR, EMUCMDTYPE_TOOL, LaunchTasEditor, 0, 0, "Open TAS Editor", 0},
{ EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch,0, 0, "Open Memory Watch", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENCHEATS, EMUCMDTYPE_TOOL, LaunchCheats, 0, 0, "Open Cheats", 0},
{ EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", 0},
{ EMUCMD_TOOL_OPENHEX, EMUCMDTYPE_TOOL, LaunchHex, 0, 0, "Open Hex Editor", 0},
@ -767,11 +767,11 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_FRAMEADV_SKIPLAG, EMUCMDTYPE_MISC, FA_SkipLag, 0, 0, "Frame Adv.-Skip Lag", 0},
{ EMUCMD_OPENROM, EMUCMDTYPE_TOOL, OpenRom, 0, 0, "Open ROM", 0},
{ EMUCMD_CLOSEROM, EMUCMDTYPE_TOOL, CloseRom, 0, 0, "Close ROM", 0},
{ EMUCMD_RELOAD, EMUCMDTYPE_TOOL, ReloadRom, 0, 0, "Reload ROM or TAS Editor Project", EMUCMDFLAG_TASEDIT },
{ EMUCMD_RELOAD, EMUCMDTYPE_TOOL, ReloadRom, 0, 0, "Reload ROM or TAS Editor Project", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_MOVIESUBTITLES, EMUCMDTYPE_MISC, MovieSubtitleToggle,0,0,"Toggle Movie Subtitles", 0},
{ EMUCMD_MISC_UNDOREDOSAVESTATE, EMUCMDTYPE_MISC, UndoRedoSavestate, 0,0,"Undo/Redo Savestate", 0},
{ EMUCMD_MISC_TOGGLEFULLSCREEN, EMUCMDTYPE_MISC, ToggleFullscreen, 0, 0, "Toggle Fullscreen", 0},
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDIT },
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENRAMSEARCH, EMUCMDTYPE_TOOL, LaunchRamSearch, 0, 0, "Open Ram Search", 0},
{ EMUCMD_TOOL_RAMSEARCHLT, EMUCMDTYPE_TOOL, RamSearchOpLT, 0, 0, "Ram Search - Less Than", 0},
{ EMUCMD_TOOL_RAMSEARCHGT, EMUCMDTYPE_TOOL, RamSearchOpGT, 0, 0, "Ram Search - Greater Than", 0},
@ -779,8 +779,8 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_TOOL_RAMSEARCHGTE, EMUCMDTYPE_TOOL, RamSearchOpGTE, 0, 0, "Ram Search - Greater Than or Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHEQ, EMUCMDTYPE_TOOL, RamSearchOpEQ, 0, 0, "Ram Search - Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHNE, EMUCMDTYPE_TOOL, RamSearchOpNE, 0, 0, "Ram Search - Not Equal", 0},
{ EMUCMD_TASEDIT_REWIND, EMUCMDTYPE_MISC, TaseditRewindOn, TaseditRewindOff, 0, "Rewind Frame (TAS Editor only)", EMUCMDFLAG_TASEDIT },
{ EMUCMD_RERECORD_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_MovieToggleRerecordDisplay, 0, 0, "Toggle Rerecord Display", EMUCMDFLAG_TASEDIT },
{ EMUCMD_TASEDITOR_REWIND, EMUCMDTYPE_MISC, TaseditorRewindOn, TaseditorRewindOff, 0, "Rewind Frame (TAS Editor only)", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_RERECORD_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_MovieToggleRerecordDisplay, 0, 0, "Toggle Rerecord Display", EMUCMDFLAG_TASEDITOR },
};
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
@ -789,16 +789,16 @@ static int execcmd, i;
void FCEUI_HandleEmuCommands(TestCommandState* testfn)
{
bool tasedit = FCEUMOV_Mode(MOVIEMODE_TASEDIT);
bool taseditor = FCEUMOV_Mode(MOVIEMODE_TASEDITOR);
for(i=0; i<NUM_EMU_CMDS; ++i)
{
int new_state;
int old_state = FCEUI_CommandTable[i].state;
execcmd = FCEUI_CommandTable[i].cmd;
new_state = (*testfn)(execcmd);
//in tasedit, forbid commands without the tasedit flag
// in TAS Editor mode forbid commands without the taseditor flag
bool allow = true;
if(tasedit && !(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDIT))
if(taseditor && !(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDITOR))
allow = false;
if(allow)
@ -837,7 +837,7 @@ static void ViewSlots(void)
static void CommandSelectSaveSlot(void)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.jump(execcmd - EMUCMD_SAVE_SLOT_0);
@ -855,7 +855,7 @@ static void CommandSelectSaveSlot(void)
static void CommandStateSave(void)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.set(execcmd - EMUCMD_SAVE_STATE_SLOT_0);
@ -876,7 +876,7 @@ static void CommandStateSave(void)
static void CommandStateLoad(void)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.unleash(execcmd - EMUCMD_LOAD_STATE_SLOT_0);
@ -939,11 +939,11 @@ void LagCounterToggle(void)
lagCounterDisplay ^= 1;
}
static void LaunchTasEdit(void)
static void LaunchTasEditor(void)
{
#ifdef WIN32
extern bool EnterTasEdit();
EnterTasEdit();
extern bool EnterTasEditor();
EnterTasEditor();
#endif
}
@ -1115,7 +1115,7 @@ static void CloseRom(void)
static void ReloadRom(void)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
// load most recent project
taseditor_window.LoadRecentProject(0);
@ -1164,13 +1164,13 @@ static void ToggleFullscreen(void)
#endif
}
static void TaseditRewindOn(void)
static void TaseditorRewindOn(void)
{
#ifdef WIN32
Taseditor_rewind_now = true;
#endif
}
static void TaseditRewindOff(void)
static void TaseditorRewindOff(void)
{
#ifdef WIN32
Taseditor_rewind_now = false;

View File

@ -204,7 +204,7 @@ enum EMUCMD
EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,
//Currently Windows only------
EMUCMD_MISC_OPENTASEDIT,
EMUCMD_MISC_OPENTASEDITOR,
EMUCMD_TOOL_OPENMEMORYWATCH,
EMUCMD_TOOL_OPENCHEATS,
EMUCMD_TOOL_OPENDEBUGGER,
@ -231,7 +231,7 @@ enum EMUCMD
EMUCMD_TOOL_RAMSEARCHEQ,
EMUCMD_TOOL_RAMSEARCHNE,
EMUCMD_TOOL_OPENNTVIEW,
EMUCMD_TASEDIT_REWIND,
EMUCMD_TASEDITOR_REWIND,
//-----------------------------
//keep adding these in order of newness or else the hotkey binding configs will get messed up...
EMUCMD_RERECORD_DISPLAY_TOGGLE,
@ -261,7 +261,7 @@ typedef void EMUCMDFN(void);
enum EMUCMDFLAG
{
EMUCMDFLAG_NONE = 0,
EMUCMDFLAG_TASEDIT = 1,
EMUCMDFLAG_TASEDITOR = 1,
};
struct EMUCMDTABLE

View File

@ -1902,9 +1902,9 @@ void TaseditorManualFunction()
CallRegisteredLuaFunctions(LUACALL_TASEDITOR_MANUAL);
}
#ifdef WIN32
void TaseditorUpdateManualFunctionStatus()
{
#ifdef WIN32
if (L)
{
// check if LUACALL_TASEDITOR_MANUAL function is not nil
@ -1915,8 +1915,8 @@ void TaseditorUpdateManualFunctionStatus()
taseditor_lua.DisableRunFunction();
lua_pop(L, 1);
} else taseditor_lua.DisableRunFunction();
#endif
}
#endif
// Not for the signed versions though
static int memory_readbytesigned(lua_State *L) {
@ -2647,7 +2647,7 @@ int emu_emulating(lua_State *L) {
// Returns "taseditor", "record", "playback", "finished" or nil
int movie_mode(lua_State *L)
{
if (FCEUMOV_Mode(MOVIEMODE_TASEDIT))
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
lua_pushstring(L, "taseditor");
else if (FCEUMOV_IsRecording())
lua_pushstring(L, "record");

View File

@ -977,7 +977,7 @@ static int _currCommand = 0;
void FCEUMOV_AddInputState()
{
#ifdef _WIN32
if(movieMode == MOVIEMODE_TASEDIT)
if(movieMode == MOVIEMODE_TASEDITOR)
{
// if movie length is less than currFrame, pad it with empty frames
if((int)currMovieData.records.size() <= currFrameCounter)
@ -1108,7 +1108,7 @@ void FCEU_DrawMovies(uint8 *XBuf)
{
sprintf(counterbuf,"%d/%d (finished)",currFrameCounter,currMovieData.records.size());
color = 0x17; //Show red to get attention
} else if(movieMode == MOVIEMODE_TASEDIT)
} else if(movieMode == MOVIEMODE_TASEDITOR)
{
sprintf(counterbuf,"%d",currFrameCounter);
} else
@ -1193,11 +1193,11 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
int result = MessageBox(hAppWnd, "This movie is a TAS Editor project file.\nIt can be modified in TAS Editor only.\n\nOpen it in TAS Editor now?", "Movie Replay", MB_YESNO);
if (result == IDYES)
{
extern bool EnterTasEdit();
extern bool EnterTasEditor();
extern bool LoadProject(char* fullname);
char fullname[512];
strcpy(fullname, curMovieFilename);
if (EnterTasEdit())
if (EnterTasEditor())
LoadProject(fullname);
}
#else
@ -1414,7 +1414,7 @@ void FCEUMOV_PreLoad(void)
bool FCEUMOV_PostLoad(void)
{
if(movieMode == MOVIEMODE_INACTIVE || movieMode == MOVIEMODE_TASEDIT)
if(movieMode == MOVIEMODE_INACTIVE || movieMode == MOVIEMODE_TASEDITOR)
return true;
else
return load_successful;
@ -1509,7 +1509,7 @@ void FCEUI_MovieToggleReadOnly()
void FCEUI_MoviePlayFromBeginning(void)
{
if (movieMode == MOVIEMODE_TASEDIT)
if (movieMode == MOVIEMODE_TASEDITOR)
{
movie_readonly = true;
#ifdef WIN32

View File

@ -60,7 +60,7 @@ enum EMOVIEMODE
MOVIEMODE_INACTIVE = 1,
MOVIEMODE_RECORD = 2,
MOVIEMODE_PLAY = 4,
MOVIEMODE_TASEDIT = 8,
MOVIEMODE_TASEDITOR = 8,
MOVIEMODE_FINISHED = 16
};

View File

@ -375,9 +375,9 @@ bool FCEUSS_SaveMS(EMUFILE* outstream, int compressionLevel)
{
totalsize+=WriteStateChunk(os,6,FCEUMOV_STATEINFO);
//MBG tasedit HACK HACK HACK!
//do not save the movie state if we are in tasedit! that is a huge waste of time and space!
if(!FCEUMOV_Mode(MOVIEMODE_TASEDIT))
//MBG TAS Editor HACK HACK HACK!
//do not save the movie state if we are in Taseditor! That would be a huge waste of time and space!
if(!FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
os->fseek(5,SEEK_CUR);
int size = FCEUMOV_WriteState(os);

View File

@ -420,7 +420,6 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
</ClCompile>
<ClCompile Include="..\src\drivers\win\tasedit.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\bookmark.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\bookmarks.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\greenzone.cpp" />
@ -430,12 +429,14 @@
<ClCompile Include="..\src\drivers\win\taseditlib\playback.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\popup_display.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\recorder.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\splicer.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_config.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_list.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_lua.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_project.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_sel.cpp" />
<ClCompile Include="..\src\drivers\win\taseditlib\taseditor_window.cpp" />
<ClCompile Include="..\src\drivers\win\taseditor.cpp" />
<ClCompile Include="..\src\drivers\win\texthook.cpp" />
<ClCompile Include="..\src\drivers\win\throttle.cpp" />
<ClCompile Include="..\src\drivers\win\timing.cpp" />
@ -745,7 +746,6 @@
<ClInclude Include="..\src\drivers\win\resource.h" />
<ClInclude Include="..\src\drivers\win\sound.h" />
<ClInclude Include="..\src\drivers\win\state.h" />
<ClInclude Include="..\src\drivers\win\tasedit.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\bookmark.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\bookmarks.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\inputhistory.h" />
@ -754,12 +754,14 @@
<ClInclude Include="..\src\drivers\win\taseditlib\playback.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\popup_display.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\recorder.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\splicer.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_config.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_list.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_lua.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_project.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_sel.h" />
<ClInclude Include="..\src\drivers\win\taseditlib\taseditor_window.h" />
<ClInclude Include="..\src\drivers\win\taseditor.h" />
<ClInclude Include="..\src\drivers\win\texthook.h" />
<ClInclude Include="..\src\drivers\win\throttle.h" />
<ClInclude Include="..\src\drivers\win\timing.h" />

View File

@ -442,9 +442,6 @@
<ClCompile Include="..\src\drivers\win\state.cpp">
<Filter>drivers\win</Filter>
</ClCompile>
<ClCompile Include="..\src\drivers\win\tasedit.cpp">
<Filter>drivers\win</Filter>
</ClCompile>
<ClCompile Include="..\src\drivers\win\texthook.cpp">
<Filter>drivers\win</Filter>
</ClCompile>
@ -952,6 +949,12 @@
<ClCompile Include="..\src\drivers\win\taseditlib\popup_display.cpp">
<Filter>drivers\win\taseditlib</Filter>
</ClCompile>
<ClCompile Include="..\src\drivers\win\taseditor.cpp">
<Filter>drivers\win</Filter>
</ClCompile>
<ClCompile Include="..\src\drivers\win\taseditlib\splicer.cpp">
<Filter>drivers\win\taseditlib</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\cart.h">
@ -1125,9 +1128,6 @@
<ClInclude Include="..\src\drivers\win\state.h">
<Filter>drivers\win</Filter>
</ClInclude>
<ClInclude Include="..\src\drivers\win\tasedit.h">
<Filter>drivers\win</Filter>
</ClInclude>
<ClInclude Include="..\src\drivers\win\texthook.h">
<Filter>drivers\win</Filter>
</ClInclude>
@ -1435,6 +1435,12 @@
<ClInclude Include="..\src\drivers\win\taseditlib\popup_display.h">
<Filter>drivers\win\taseditlib</Filter>
</ClInclude>
<ClInclude Include="..\src\drivers\win\taseditor.h">
<Filter>drivers\win</Filter>
</ClInclude>
<ClInclude Include="..\src\drivers\win\taseditlib\splicer.h">
<Filter>drivers\win\taseditlib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\src\drivers\win\res.rc">