diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index aa491c99..0b5a49ea 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -1007,5 +1007,5 @@ void Replay_LoadMovie(bool tasedit) /// Show movie replay dialog and replay the movie if necessary. void FCEUD_MovieReplayFrom() { - Replay_LoadMovie(false); + if (GameInfo) Replay_LoadMovie(false); } diff --git a/src/drivers/win/tasedit.cpp b/src/drivers/win/tasedit.cpp index 722a52d3..01b9fb3c 100644 --- a/src/drivers/win/tasedit.cpp +++ b/src/drivers/win/tasedit.cpp @@ -15,7 +15,6 @@ #include "joystick.h" #include "help.h" #include "main.h" //For the GetRomName() function -//#include "config.h" using namespace std; @@ -23,7 +22,7 @@ using namespace std; //http://forums.devx.com/archive/index.php/t-37234.html int TasEdit_wndx, TasEdit_wndy; -bool TASEdit_follow_playback = false; +bool TASEdit_follow_playback = true; string tasedithelp = "{16CDE0C4-02B0-4A60-A88D-076319909A4D}"; //Name of TASEdit Help page @@ -178,20 +177,14 @@ void UpdateTasEdit() ListView_SetItemCountEx(hwndList,currMovieData.getNumRecords(),LVSICF_NOSCROLL | LVSICF_NOINVALIDATEALL); } - //update the cursor when playing - int newCursor = currFrameCounter; - if(newCursor != lastCursor) + //update the cursor + if(currFrameCounter != lastCursor) { - /* if (!FCEUI_EmulationPaused()) - //select the row - ListView_SetItemState(hwndList,newCursor,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED); - */ - //scroll to the row - if (TASEdit_follow_playback) ListView_EnsureVisible(hwndList,newCursor,FALSE); //update the old and new rows - ListView_Update(hwndList,newCursor); ListView_Update(hwndList,lastCursor); - lastCursor = newCursor; + ListView_Update(hwndList,currFrameCounter); + lastCursor = currFrameCounter; + FollowPlayback(); } static int old_movie_readonly=-1; @@ -285,11 +278,12 @@ bool JumpToFrame(int index) { if (index<0) return false; - /* Handle jumps outside greenzone. */ - if (index>currMovieData.greenZoneCount) + if (index >= currMovieData.greenZoneCount) { + /* Handle jumps outside greenzone. */ if (JumpToFrame(currMovieData.greenZoneCount-1)) { + // continue from the end of greenzone if (FCEUI_EmulationPaused()) FCEUI_ToggleEmulationPause(); @@ -300,42 +294,34 @@ bool JumpToFrame(int index) } return false; } - - if (static_cast(index)0? index-1:0; - if (i>=static_cast(currMovieData.records.size())) - i=currMovieData.records.size()-1; - - /* Search for an earlier frame, and try warping to the current. */ - for (; i>0; --i) + int i = (index > 0) ? index-1 : 0; + //if (i >= static_cast(currMovieData.records.size())) i = currMovieData.records.size()-1; + //Search for an earlier frame with savestate + for (; i > 0; --i) { - if (currMovieData.loadTasSavestate(i)) - { - currFrameCounter=i; - turbo=i+6060; + // continue from the frame + currFrameCounter = i; + if (FCEUI_EmulationPaused()) FCEUI_ToggleEmulationPause(); + turbo=i+600) - JumpToFrame(currFrameCounter-1); + if (currFrameCounter>0) JumpToFrame(currFrameCounter-1); + FollowPlayback(); break; case TASEDIT_PLAYSTOP: //Pause/Unpses (Play/Stop) movie @@ -1254,15 +1241,18 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case TASEDIT_REWIND_FULL: //rewinds to beginning of greenzone JumpToFrame(FindBeginningOfGreenZone(0)); + FollowPlayback(); break; case TASEDIT_FOWARD_FULL: //moves to the end of greenzone JumpToFrame(currMovieData.greenZoneCount-1); + FollowPlayback(); 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); + FollowPlayback(); break; } break; @@ -1279,6 +1269,10 @@ int FindBeginningOfGreenZone(int starting_index) } return starting_index; } +void FollowPlayback() +{ + if (TASEdit_follow_playback) ListView_EnsureVisible(hwndList,currFrameCounter,FALSE); +} void DoTasEdit() { diff --git a/src/drivers/win/tasedit.h b/src/drivers/win/tasedit.h index 6218acf6..e02099aa 100644 --- a/src/drivers/win/tasedit.h +++ b/src/drivers/win/tasedit.h @@ -59,3 +59,4 @@ void CreateProject(MovieData data); void InvalidateGreenZone(int after); bool JumpToFrame(int index); int FindBeginningOfGreenZone(int starting_index); +void FollowPlayback(); diff --git a/src/movie.cpp b/src/movie.cpp index 82a5d1c7..cd6dd5b1 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -125,31 +125,14 @@ void MovieData::TryDumpIncremental() { if(movieMode == MOVIEMODE_TASEDIT) { - //only log the savestate if we are appending to the green zone - if (turbo && pauseframe!=-1 && static_cast(currFrameCounter)currFrameCounter && ((currFrameCounter-pauseframe)&0xff)) - return; - currMovieData.storeTasSavestate(currFrameCounter, Z_DEFAULT_COMPRESSION); - } - if(currFrameCounter == currMovieData.greenZoneCount) - { - if(currFrameCounter == (int)currMovieData.records.size() || currMovieData.records.size()==0) - { - currMovieData.insertEmpty(-1,1); - } - - currMovieData.storeTasSavestate(currFrameCounter, Z_DEFAULT_COMPRESSION); - currMovieData.greenZoneCount=currFrameCounter+1; - } else if (currFrameCounter < currMovieData.greenZoneCount && !movie_readonly) - { - currMovieData.storeTasSavestate(currFrameCounter, Z_DEFAULT_COMPRESSION); - } else if (currFrameCounter > currMovieData.greenZoneCount && static_cast(currMovieData.greenZoneCount)= (int)currMovieData.records.size() || currMovieData.records.size()==0) + currMovieData.insertEmpty(-1, 1 + currFrameCounter - (int)currMovieData.records.size()); + //always log savestates in taseditor mode + currMovieData.storeTasSavestate(currFrameCounter, Z_DEFAULT_COMPRESSION); + // update greenzone upper limit + if (currMovieData.greenZoneCount <= currFrameCounter) + currMovieData.greenZoneCount = currFrameCounter+1; } }