w32-Tasedit: Enable insert frames, improve greenZoneCount stability, TAS fastforward performance boost.

This commit is contained in:
mart0258 2010-03-09 03:40:10 +00:00
parent 8d3328c177
commit c1590b3a1b
4 changed files with 22 additions and 8 deletions

View File

@ -321,13 +321,13 @@ TASEDITCONTEXTMENUS MENU
BEGIN
POPUP "Stray"
BEGIN
MENUITEM "Insert Frames", MENU_CONTEXT_STRAY_INSERTFRAMES, INACTIVE
MENUITEM "Insert Frames", MENU_CONTEXT_STRAY_INSERTFRAMES
MENUITEM SEPARATOR
MENUITEM "Truncate", ID_CONTEXT_STRAY_TRUNCATE
END
POPUP "Selected"
BEGIN
MENUITEM "Insert Frame(s)", ID_CONTEXT_SELECTED_INSERTFRAMES, INACTIVE
MENUITEM "Insert Frame(s)", ID_CONTEXT_SELECTED_INSERTFRAMES
MENUITEM "Delete Frame(s)", ID_CONTEXT_SELECTED_DELETEFRAMES
MENUITEM SEPARATOR
MENUITEM "Paste to New", ID_CONTEXT_SELECTED_PASTETONEW, INACTIVE
@ -1291,7 +1291,7 @@ BEGIN
PUSHBUTTON ">",TASEDIT_FOWARD,391,25,26,14
PUSHBUTTON "<<",TASEDIT_REWIND_FULL,341,25,26,14
PUSHBUTTON ">>",TASEDIT_FOWARD_FULL,417,25,26,14
GROUPBOX "Static",IDC_STATIC,335,11,120,176
GROUPBOX "Frames",IDC_STATIC,335,11,120,176
GROUPBOX "Project Input Logs",IDC_STATIC,335,200,120,175
PUSHBUTTON "Record P1",IDC_BUTTON5,340,95,50,14,WS_DISABLED
PUSHBUTTON "Record P2",IDC_BUTTON7,340,79,50,14,WS_DISABLED

View File

@ -395,6 +395,8 @@ static void InsertFrames()
currMovieData.insertEmpty(*it,1);
}
if (currFrameCounter>=*selectionFrames.begin())
JumpToFrame(*selectionFrames.begin());
InvalidateGreenZone(*selectionFrames.begin());
UpdateTasEdit();
RedrawList();
@ -1175,7 +1177,8 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
int frames;
if(CWin32InputBox::GetInteger("Insert Frames", "How many frames?", frames, hwndDlg) == IDOK)
{
currMovieData.insertEmpty(-1,frames);
currMovieData.insertEmpty(currFrameCounter,frames);
InvalidateGreenZone(currFrameCounter);
RedrawList();
}
}

View File

@ -89,11 +89,13 @@ bool TASEDIT_PROJECT::LoadProject(std::string PFN)
LoadFM2(currMovieData, &ifs, INT_MAX, false);
LoadSubtitles(currMovieData);
char asdf;
ifs.get(asdf); // TODO: Add main branch name.
char branchname;
ifs.get(branchname); // TODO: Add main branch name.
currMovieData.loadGreenzone(&ifs, true);
poweron(true);
currFrameCounter = currMovieData.greenZoneCount;
currMovieData.TryDumpIncremental();
ifs.close();

View File

@ -124,6 +124,12 @@ void MovieData::TryDumpIncremental()
if(movieMode == MOVIEMODE_TASEDIT)
{
//only log the savestate if we are appending to the green zone
if (turbo && pauseframe!=-1 && currFrameCounter<currMovieData.records.size())
{
if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff))
return;
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
}
if(currFrameCounter == currMovieData.greenZoneCount)
{
if(currFrameCounter == (int)currMovieData.records.size() || currMovieData.records.size()==0)
@ -135,9 +141,12 @@ void MovieData::TryDumpIncremental()
currMovieData.greenZoneCount++;
} else if (currFrameCounter < currMovieData.greenZoneCount || !movie_readonly)
{
if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff))
return;
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
} else if (currFrameCounter > currMovieData.greenZoneCount && currMovieData.greenZoneCount<currMovieData.records.size())
{
/* May be required in some malformed TAS projects. */
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
currMovieData.greenZoneCount= currFrameCounter+1;
}
}
}