* red lines for lag frames, "Show lag frames" in View menu,

* "||" button also cancels turbo-seeking
* different method of accounting tweakCount: increment once per greenzone invalidation
This commit is contained in:
ansstuff 2011-09-06 15:42:03 +00:00
parent 9a76571490
commit 5a2d97662f
9 changed files with 92 additions and 49 deletions

View File

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

View File

@ -44,6 +44,7 @@ static struct
{ EMUCMD_LOAD_STATE, SCAN_P, }, //most people use the loadslotx / savestlotx style system which requires hogging all th F Keys.
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, SCAN_PERIOD, },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, SCAN_COMMA, },
{ EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE, SCAN_SLASH, },
{ EMUCMD_MOVIE_READONLY_TOGGLE, SCAN_Q, },
{ EMUCMD_SAVE_STATE_SLOT_0, SCAN_F10 | CMD_KEY_SHIFT, },
{ EMUCMD_SAVE_STATE_SLOT_1, SCAN_F1 | CMD_KEY_SHIFT, },

View File

@ -246,6 +246,8 @@ BEGIN
END
POPUP "&View"
BEGIN
MENUITEM "Show &lag frames", ID_VIEW_SHOW_LAG_FRAMES
MENUITEM SEPARATOR
MENUITEM "&Follow playback", ID_VIEW_FOLLOW_PLAYBACK
END
POPUP "&Help"

View File

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

View File

@ -23,6 +23,7 @@ using namespace std;
int TasEdit_wndx, TasEdit_wndy;
bool TASEdit_follow_playback = true;
bool TASEdit_show_lag_frames = true;
string tasedithelp = "{16CDE0C4-02B0-4A60-A88D-076319909A4D}"; //Name of TASEdit Help page
@ -112,9 +113,15 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
msg->clrTextBk = CUR_FRAMENUM_COLOR;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
if (TASEdit_show_lag_frames && currMovieData.frames_flags[cell_y] && (currMovieData.frames_flags[cell_y] & LAG_FLAG_BIT))
{
// lag frame
msg->clrTextBk = LAG_FRAMENUM_COLOR;
} else
{
// 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)
{
@ -125,9 +132,15 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
msg->clrTextBk = CUR_INPUT_COLOR1;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
if (TASEdit_show_lag_frames && currMovieData.frames_flags[cell_y] && (currMovieData.frames_flags[cell_y] & LAG_FLAG_BIT))
{
// lag frame
msg->clrTextBk = LAG_INPUT_COLOR1;
} else
{
// 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)
{
@ -138,9 +151,15 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
msg->clrTextBk = CUR_INPUT_COLOR2;
} else if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
{
// TODO: redline for lag frames
if (TASEdit_show_lag_frames && currMovieData.frames_flags[cell_y] && (currMovieData.frames_flags[cell_y] & LAG_FLAG_BIT))
{
// lag frame
msg->clrTextBk = LAG_INPUT_COLOR2;
} else
{
// green zone frame
msg->clrTextBk = GREENZONE_INPUT_COLOR2;
}
} else msg->clrTextBk = NORMAL_INPUT_COLOR2;
}
}
@ -264,10 +283,16 @@ void LockGreenZone(int newstart)
void InvalidateGreenZone(int after)
{
currMovieData.greenZoneCount = std::min(after+1,currMovieData.greenZoneCount);
if (currMovieData.greenZoneCount > after+1)
{
currMovieData.greenZoneCount = after+1;
// increase tweakCount
currMovieData.tweakCount++;
InvalidateRect(hwndTasEdit,0,FALSE);
if (currFrameCounter >= currMovieData.greenZoneCount)
JumpToFrame(currMovieData.greenZoneCount-1);
}
}
/* A function that tries jumping to a given frame. If unsuccessful, it than tries to jump to
a previously good frame and fastforward to it.
@ -287,7 +312,7 @@ bool JumpToFrame(int index)
if (FCEUI_EmulationPaused())
FCEUI_ToggleEmulationPause();
turbo=currMovieData.greenZoneCount+60<index; // turbo unless close
turbo = (currMovieData.greenZoneCount-1+FRAMES_TOO_FAR < index);
pauseframe=index+1;
return true;
@ -299,11 +324,9 @@ bool JumpToFrame(int index)
{
currFrameCounter = index;
return true;
} else
{
int i = (index > 0) ? index-1 : 0;
//if (i >= static_cast<int>(currMovieData.records.size())) i = currMovieData.records.size()-1;
}
//Search for an earlier frame with savestate
int i = (index>0)? index-1 : 0;
for (; i > 0; --i)
{
if (currMovieData.loadTasSavestate(i)) break;
@ -311,7 +334,7 @@ bool JumpToFrame(int index)
// continue from the frame
currFrameCounter = i;
if (FCEUI_EmulationPaused()) FCEUI_ToggleEmulationPause();
turbo=i+60<index; // turbo unless close
turbo = (i+FRAMES_TOO_FAR < index);
pauseframe=index+1;
if (!i)
{
@ -321,18 +344,6 @@ bool JumpToFrame(int index)
}
return true;
}
/*
// Simply do a reset.
if (index==0)
{
poweron(false);
currFrameCounter=0;
MovieData::dumpSavestateTo(&currMovieData.savestates[0],0);
return true;
}
*/
return false;
}
void DoubleClick(LPNMITEMACTIVATE info)
{
@ -1237,6 +1248,12 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case TASEDIT_PLAYSTOP:
//Pause/Unpses (Play/Stop) movie
FCEUI_ToggleEmulationPause();
// also cancel turbo-seeking
if (FCEUI_EmulationPaused())
{
turbo = false;
pauseframe = -1;
}
break;
case TASEDIT_REWIND_FULL:
//rewinds to beginning of greenzone
@ -1254,6 +1271,13 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
CheckMenuItem(hmenu, ID_VIEW_FOLLOW_PLAYBACK, TASEdit_follow_playback?MF_CHECKED : MF_UNCHECKED);
FollowPlayback();
break;
case ID_VIEW_SHOW_LAG_FRAMES:
//switch "Show lag frames" flag
TASEdit_show_lag_frames ^= 1;
CheckMenuItem(hmenu, ID_VIEW_SHOW_LAG_FRAMES, TASEdit_show_lag_frames?MF_CHECKED : MF_UNCHECKED);
RedrawList();
break;
}
break;
}
@ -1286,6 +1310,7 @@ void DoTasEdit()
hrmenu = LoadMenu(fceu_hInstance,"TASEDITCONTEXTMENUS");
// check option ticks
CheckMenuItem(hmenu, ID_VIEW_FOLLOW_PLAYBACK, TASEdit_follow_playback?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_SHOW_LAG_FRAMES, TASEdit_show_lag_frames?MF_CHECKED : MF_UNCHECKED);
if(hwndTasEdit)
{

View File

@ -1,5 +1,6 @@
#include "movie.h"
#define FRAMES_TOO_FAR 60
#define NUM_JOYPADS 4
#define NUM_JOYPAD_BUTTONS 8
// listview column names
@ -44,13 +45,13 @@
#define GREENZONE_FRAMENUM_COLOR 0xDCFFDC
#define LAG_FRAMENUM_COLOR 0xDAD9FE
#define NORMAL_INPUT_COLOR1 0xF0F0F0
#define CUR_INPUT_COLOR1 0xFBEDB7
#define CUR_INPUT_COLOR1 0xF7E9B2
#define GREENZONE_INPUT_COLOR1 0xC3FFC3
#define LAG_INPUT_COLOR1 0xC9C3FF
#define LAG_INPUT_COLOR1 0xCCC8EE
#define NORMAL_INPUT_COLOR2 0xDEDEDE
#define CUR_INPUT_COLOR2 0xE4D8A8
#define GREENZONE_INPUT_COLOR2 0xAEE2AE
#define LAG_INPUT_COLOR2 0xAFAADC
#define LAG_INPUT_COLOR2 0xB8B3E2
// -----------------------------
void DoTasEdit();

View File

@ -706,8 +706,6 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
}
currMovieData.TryDumpIncremental();
if (lagFlag)
{
lagCounter++;
@ -715,6 +713,9 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
}
else justLagged = false;
// auto-savestates for TASEditor
currMovieData.TryDumpIncremental();
if (movieSubtitles)
ProcessSubtitles();
}

View File

@ -130,6 +130,14 @@ void MovieData::TryDumpIncremental()
currMovieData.insertEmpty(-1, 1 + currFrameCounter - (int)currMovieData.records.size());
//always log savestates in taseditor mode
currMovieData.storeTasSavestate(currFrameCounter, Z_DEFAULT_COMPRESSION);
// also log frame_flags
if (currFrameCounter > 0)
{
if ((int)currMovieData.frames_flags.size() <= currFrameCounter)
currMovieData.frames_flags.resize(currFrameCounter+1);
// lagFlag indicates that lag was in previous frame
currMovieData.frames_flags[currFrameCounter-1] = (lagFlag)?LAG_FLAG_BIT:0;
}
// update greenzone upper limit
if (currMovieData.greenZoneCount <= currFrameCounter)
currMovieData.greenZoneCount = currFrameCounter+1;
@ -904,7 +912,6 @@ void MovieData::storeTasSavestate(int frame, int compression_level)
savestates.resize(frame+1);
MovieData::dumpSavestateTo(&savestates[frame],compression_level);
tweakCount++;
}
//begin playing an existing movie

View File

@ -1,6 +1,8 @@
#ifndef __MOVIE_H_
#define __MOVIE_H_
#define LAG_FLAG_BIT 1
#include <vector>
#include <map>
#include <string>
@ -173,6 +175,7 @@ public:
std::vector<uint8> savestate;
std::vector<MovieRecord> records;
std::vector<std::vector<uint8> > savestates;
std::vector<uint8> frames_flags;
std::vector<std::wstring> comments;
std::vector<std::string> subtitles;
//this is the RERECORD COUNT. please rename variable.