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

View File

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

View File

@ -807,6 +807,7 @@
#define IDC_C_WATCH_Separa 40416 #define IDC_C_WATCH_Separa 40416
#define ID_GAME_USECONFIG 40417 #define ID_GAME_USECONFIG 40417
#define FCEUX_CONTEXT_GUICONFIG 40418 #define FCEUX_CONTEXT_GUICONFIG 40418
#define ID_VIEW_FOLLOW_PLAYBACK 40419
#define IDC_DEBUGGER_ICONTRAY 55535 #define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423 #define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426 #define MW_ValueLabel1 65426
@ -816,7 +817,7 @@
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 160 #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_CONTROL_VALUE 1261
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif

View File

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

View File

@ -58,3 +58,4 @@ void UpdateTasEdit();
void CreateProject(MovieData data); void CreateProject(MovieData data);
void InvalidateGreenZone(int after); void InvalidateGreenZone(int after);
bool JumpToFrame(int index); 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_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_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_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_OPENCHEATS, EMUCMDTYPE_TOOL, LaunchCheats, 0, 0, "Open Cheats", 0},
{ EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", 0}, { EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", 0},
{ EMUCMD_TOOL_OPENHEX, EMUCMDTYPE_TOOL, LaunchHex, 0, 0, "Open Hex Editor", 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_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_UNDOREDOSAVESTATE, EMUCMDTYPE_MISC, UndoRedoSavestate, 0,0,"Undo/Redo Savestate", 0},
{ EMUCMD_MISC_TOGGLEFULLSCREEN, EMUCMDTYPE_MISC, ToggleFullscreen, 0, 0, "Toggle Fullscreen", 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_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_RAMSEARCHLT, EMUCMDTYPE_TOOL, RamSearchOpLT, 0, 0, "Ram Search - Less Than", 0},
{ EMUCMD_TOOL_RAMSEARCHGT, EMUCMDTYPE_TOOL, RamSearchOpGT, 0, 0, "Ram Search - Greater Than", 0}, { EMUCMD_TOOL_RAMSEARCHGT, EMUCMDTYPE_TOOL, RamSearchOpGT, 0, 0, "Ram Search - Greater Than", 0},