* added "Follow playback" in View menu

* "<<" button now jumps to the beginning of greenzone
* changing currFrameCounter doesn't reset selection anymore
* fixed "Select All" function
This commit is contained in:
ansstuff 2011-09-05 13:12:24 +00:00
parent 711bc0c438
commit 2a75b9b8e8
6 changed files with 83 additions and 69 deletions

View File

@ -67,6 +67,7 @@ extern bool SingleInstanceOnly;
extern bool oldInputDisplay;
extern bool fullSaveStateLoads;
extern int frameSkipAmt;
extern bool TASEdit_follow_playback;
//window positions and sizes:
extern int ChtPosX,ChtPosY;
@ -282,6 +283,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(AFoff),
AC(AutoFireOffset),
AC(DesynchAutoFire),
AC(TASEdit_follow_playback),
AC(lagCounterDisplay),
AC(oldInputDisplay),
AC(movieSubtitles),

View File

@ -244,7 +244,10 @@ BEGIN
MENUITEM "&Truncate\tCtrl+T", ID_EDIT_TRUNCATE
MENUITEM "&Branch\tCtrl+B", ID_EDIT_BRANCH, INACTIVE
END
MENUITEM "&View", ID_VIEW, INACTIVE
POPUP "&View"
BEGIN
MENUITEM "&Follow playback", ID_VIEW_FOLLOW_PLAYBACK
END
POPUP "&Help"
BEGIN
MENUITEM "&TASEdit Help...", ID_HELP_TASEDITHELP

View File

@ -807,6 +807,7 @@
#define IDC_C_WATCH_Separa 40416
#define ID_GAME_USECONFIG 40417
#define FCEUX_CONTEXT_GUICONFIG 40418
#define ID_VIEW_FOLLOW_PLAYBACK 40419
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -816,7 +817,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 160
#define _APS_NEXT_COMMAND_VALUE 40419
#define _APS_NEXT_COMMAND_VALUE 40420
#define _APS_NEXT_CONTROL_VALUE 1261
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -15,6 +15,7 @@
#include "joystick.h"
#include "help.h"
#include "main.h" //For the GetRomName() function
//#include "config.h"
using namespace std;
@ -22,6 +23,7 @@ using namespace std;
//http://forums.devx.com/archive/index.php/t-37234.html
int TasEdit_wndx, TasEdit_wndy;
bool TASEdit_follow_playback = false;
string tasedithelp = "{16CDE0C4-02B0-4A60-A88D-076319909A4D}"; //Name of TASEdit Help page
@ -100,45 +102,48 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont);
cell_x = msg->iSubItem;
cell_y = msg->nmcd.dwItemSpec;
if(cell_x == COLUMN_ARROW || cell_x == COLUMN_FRAMENUM || cell_x == COLUMN_FRAMENUM2)
if(cell_x > COLUMN_ARROW)
{
// frame number
if (cell_y == currFrameCounter)
if(cell_x == COLUMN_FRAMENUM || cell_x == COLUMN_FRAMENUM2)
{
// current frame
msg->clrTextBk = CUR_FRAMENUM_COLOR;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
// frame number
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = CUR_FRAMENUM_COLOR;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_FRAMENUM_COLOR;
} else msg->clrTextBk = NORMAL_FRAMENUM_COLOR;
} else if((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 0 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 2)
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_FRAMENUM_COLOR;
} else msg->clrTextBk = NORMAL_FRAMENUM_COLOR;
} else if((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 0 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 2)
{
// pad 1 or 3
if (cell_y == currFrameCounter)
// pad 1 or 3
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = CUR_INPUT_COLOR1;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_INPUT_COLOR1;
} else msg->clrTextBk = NORMAL_INPUT_COLOR1;
} else if((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 1 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 3)
{
// current frame
msg->clrTextBk = CUR_INPUT_COLOR1;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_INPUT_COLOR1;
} else msg->clrTextBk = NORMAL_INPUT_COLOR1;
} else if((cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 1 || (cell_x - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS == 3)
{
// pad 2 or 4
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = CUR_INPUT_COLOR2;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_INPUT_COLOR2;
} else msg->clrTextBk = NORMAL_INPUT_COLOR2;
// pad 2 or 4
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = CUR_INPUT_COLOR2;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = GREENZONE_INPUT_COLOR2;
} else msg->clrTextBk = NORMAL_INPUT_COLOR2;
}
}
return CDRF_DODEFAULT;
default:
@ -173,26 +178,19 @@ void UpdateTasEdit()
ListView_SetItemCountEx(hwndList,currMovieData.getNumRecords(),LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL);
}
//update the cursor
//update the cursor when playing
int newCursor = currFrameCounter;
if(newCursor != lastCursor)
{
//unselect all prior rows
TSelectionFrames oldSelected = selectionFrames;
for(TSelectionFrames::iterator it(oldSelected.begin()); it != oldSelected.end(); it++)
ListView_SetItemState(hwndList,*it,0, LVIS_FOCUSED|LVIS_SELECTED);
/* if (!FCEUI_EmulationPaused())
//select the row
ListView_SetItemState(hwndList,newCursor,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
*/
//scroll to the row
ListView_EnsureVisible(hwndList,newCursor,FALSE);
//select the row
ListView_SetItemState(hwndList,newCursor,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
if (TASEdit_follow_playback) ListView_EnsureVisible(hwndList,newCursor,FALSE);
//update the old and new rows
ListView_Update(hwndList,newCursor);
ListView_Update(hwndList,lastCursor);
for(TSelectionFrames::iterator it(oldSelected.begin()); it != oldSelected.end(); it++)
ListView_Update(hwndList,*it);
lastCursor = newCursor;
}
@ -515,9 +513,10 @@ static void SelectAll()
{
ClearSelection();
for(unsigned int i=0;i<currMovieData.records.size();i++)
{
selectionFrames.insert(i);
UpdateTasEdit();
ListView_SetItemState(hwndList,i,LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
}
RedrawList();
}
@ -997,6 +996,7 @@ static void Truncate()
frame=*selectionFrames.begin();
JumpToFrame(frame);
}
ClearSelection();
currMovieData.truncateAt(frame+1);
InvalidateGreenZone(frame);
@ -1242,27 +1242,28 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
//advance 1 frame
JumpToFrame(currFrameCounter+1);
break;
case TASEDIT_REWIND:
//rewinds 1 frame
if (currFrameCounter>0)
JumpToFrame(currFrameCounter-1);
break;
case TASEDIT_PLAYSTOP:
//Pause/Unpses (Play/Stop) movie
FCEUI_ToggleEmulationPause();
break;
case TASEDIT_REWIND_FULL:
//rewinds to beginning of movie
JumpToFrame(0);
//rewinds to beginning of greenzone
JumpToFrame(FindBeginningOfGreenZone(0));
break;
case TASEDIT_FOWARD_FULL:
//moves to the end of greenzone
JumpToFrame(currMovieData.greenZoneCount-1);
break;
case ID_VIEW_FOLLOW_PLAYBACK:
//switch "Follow playback" flag
TASEdit_follow_playback ^= 1;
CheckMenuItem(hmenu, ID_VIEW_FOLLOW_PLAYBACK, TASEdit_follow_playback?MF_CHECKED : MF_UNCHECKED);
break;
}
break;
}
@ -1270,21 +1271,27 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
return FALSE;
}
int FindBeginningOfGreenZone(int starting_index)
{
for (int i=starting_index; i<currMovieData.greenZoneCount; ++i)
{
if (!currMovieData.savestates[i].empty()) return i;
}
return starting_index;
}
void DoTasEdit()
{
if(!FCEU_IsValidUI(FCEUI_TASEDIT))
return;
if(!hmenu)
{
hmenu = LoadMenu(fceu_hInstance,"TASEDITMENU");
hrmenu = LoadMenu(fceu_hInstance,"TASEDITCONTEXTMENUS");
}
lastCursor = -1;
if(!hwndTasEdit)
hwndTasEdit = CreateDialog(fceu_hInstance,"TASEDIT",NULL,WndprocTasEdit);
hwndTasEdit = CreateDialog(fceu_hInstance,"TASEDIT",hAppWnd,WndprocTasEdit);
hmenu = GetMenu(hwndTasEdit);
hrmenu = LoadMenu(fceu_hInstance,"TASEDITCONTEXTMENUS");
// check option ticks
CheckMenuItem(hmenu, ID_VIEW_FOLLOW_PLAYBACK, TASEdit_follow_playback?MF_CHECKED : MF_UNCHECKED);
if(hwndTasEdit)
{

View File

@ -58,3 +58,4 @@ void UpdateTasEdit();
void CreateProject(MovieData data);
void InvalidateGreenZone(int after);
bool JumpToFrame(int index);
int FindBeginningOfGreenZone(int starting_index);

View File

@ -744,7 +744,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ 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_LAGCOUNTER_RESET, EMUCMDTYPE_MISC, LagCounterReset, 0, 0, "Lag Counter Reset", 0},
{ EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch,0, 0, "Open Memory Watch", 0},
{ EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch,0, 0, "Open Memory Watch", EMUCMDFLAG_TASEDIT },
{ 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},
@ -759,7 +759,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ 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", 0},
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDIT},
{ 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},