TAS Editor usability tweaks:

* fixed column widths
* frame_display can be shown in taseditor mode
* ">>" button now jumps to the end of greenzone
* some other hotkeys now also work in TAS Editor

Fixed hidden bug:
* user could change previous input by clicking on header (thus not changing currFrameCounter) and then continue greenzoning from irrelevant savestate with Frame Advance key
* how it was fixed: now currFrameCounter resets to last frame of greenzone
This commit is contained in:
ansstuff 2011-09-03 14:33:51 +00:00
parent 4197dc1957
commit 711bc0c438
5 changed files with 123 additions and 104 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 220 B

View File

@ -100,54 +100,45 @@ static LONG CustomDraw(NMLVCUSTOMDRAW* msg)
SelectObject(msg->nmcd.hdc,debugSystem->hFixedFont);
cell_x = msg->iSubItem;
cell_y = msg->nmcd.dwItemSpec;
if(cell_x == 1 || cell_x == 34)
if(cell_x == COLUMN_ARROW || cell_x == COLUMN_FRAMENUM || cell_x == COLUMN_FRAMENUM2)
{
// frame number
if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
if (cell_y == currFrameCounter)
{
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = RGB(217,254,253);
} else
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = RGB(220,255,220);
}
} else msg->clrTextBk = RGB(255,255,255);
// 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)
{
// pad 1 or 3
if(cell_y < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
if (cell_y == currFrameCounter)
{
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = RGB(195,255,250);
} else
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = RGB(195,255,195);
}
} else msg->clrTextBk = RGB(240,240,240);
// 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 < currMovieData.greenZoneCount && !currMovieData.savestates[cell_y].empty())
if (cell_y == currFrameCounter)
{
if (cell_y == currFrameCounter)
{
// current frame
msg->clrTextBk = RGB(170,220,218);
} else
{
// TODO: redline for lag frames
// green zone frame
msg->clrTextBk = RGB(170,220,170);
}
} else msg->clrTextBk = RGB(220,220,220);
// 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:
@ -283,6 +274,8 @@ void LockGreenZone(int newstart)
void InvalidateGreenZone(int after)
{
currMovieData.greenZoneCount = std::min(after+1,currMovieData.greenZoneCount);
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
@ -394,13 +387,6 @@ void DoubleClick(LPNMITEMACTIVATE info)
}
InvalidateGreenZone(index);
// If the change is in the past, move to it.
if(index < currFrameCounter && index < currMovieData.greenZoneCount)
{
JumpToFrame(index);
}
//redraw everything to show the reduced green zone
RedrawList();
}
@ -734,7 +720,10 @@ static LRESULT APIENTRY HeaderWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lP
{
switch(msg)
{
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_SETCURSOR:
return true; // no column resizing
case WM_LBUTTONDOWN:
{
//perform hit test
HD_HITTESTINFO info;
@ -755,6 +744,18 @@ static LRESULT APIENTRY ListWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar
{
case WM_CHAR:
return 0;
case WM_NOTIFY:
{
switch (((LPNMHDR)lParam)->code)
{
case HDN_BEGINTRACKW:
case HDN_BEGINTRACKA:
case HDN_TRACK:
return true; // no column resizing
}
break;
}
}
return CallWindowProc(hwndList_oldWndProc,hWnd,msg,wParam,lParam);
}
@ -775,7 +776,7 @@ static void InitDialog()
hwndList_oldWndProc = (WNDPROC)SetWindowLong(hwndList,GWL_WNDPROC,(LONG)ListWndProc);
//setup all images for the listview
HIMAGELIST himglist = ImageList_Create(12,12,ILC_COLOR32 | ILC_MASK,1,1);
HIMAGELIST himglist = ImageList_Create(8,12,ILC_COLOR32 | ILC_MASK,1,1);
HBITMAP bmp = LoadBitmap(fceu_hInstance,MAKEINTRESOURCE(IDB_TE_ARROW));
ImageList_AddMasked(himglist, bmp, RGB(255,0,255));
DeleteObject(bmp);
@ -792,7 +793,7 @@ static void InitDialog()
ListView_InsertColumn(hwndList, colidx++, &lvc);
// frame number column
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.cx = 95;
lvc.cx = 92;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, colidx++, &lvc);
// pads columns
@ -807,7 +808,7 @@ static void InitDialog()
}
}
// frame number column again
lvc.cx = 95;
lvc.cx = 92;
lvc.pszText = "Frame#";
ListView_InsertColumn(hwndList, colidx++, &lvc);
//-----------------------------
@ -1258,8 +1259,8 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
JumpToFrame(0);
break;
case TASEDIT_FOWARD_FULL:
//moves to the end of the move (or green zone?)
JumpToFrame(currMovieData.records.size()-1 );
//moves to the end of greenzone
JumpToFrame(currMovieData.greenZoneCount-1);
break;
}

View File

@ -1,44 +1,60 @@
#include "movie.h"
#define NUM_JOYPADS 4
#define NUM_JOYPAD_BUTTONS 8
#define COLUMN_ARROW 0
#define COLUMN_FRAMENUM 1
#define COLUMN_JOYPAD1_A 2
#define COLUMN_JOYPAD1_B 3
#define COLUMN_JOYPAD1_S 4
#define COLUMN_JOYPAD1_T 5
#define COLUMN_JOYPAD1_U 6
#define COLUMN_JOYPAD1_D 7
#define COLUMN_JOYPAD1_L 8
#define COLUMN_JOYPAD1_R 9
#define COLUMN_JOYPAD2_A 10
#define COLUMN_JOYPAD2_B 11
#define COLUMN_JOYPAD2_S 12
#define COLUMN_JOYPAD2_T 13
#define COLUMN_JOYPAD2_U 14
#define COLUMN_JOYPAD2_D 15
#define COLUMN_JOYPAD2_L 16
#define COLUMN_JOYPAD2_R 17
#define COLUMN_JOYPAD3_A 18
#define COLUMN_JOYPAD3_B 19
#define COLUMN_JOYPAD3_S 20
#define COLUMN_JOYPAD3_T 21
#define COLUMN_JOYPAD3_U 22
#define COLUMN_JOYPAD3_D 23
#define COLUMN_JOYPAD3_L 24
#define COLUMN_JOYPAD3_R 25
#define COLUMN_JOYPAD4_A 26
#define COLUMN_JOYPAD4_B 27
#define COLUMN_JOYPAD4_S 28
#define COLUMN_JOYPAD4_T 29
#define COLUMN_JOYPAD4_U 30
#define COLUMN_JOYPAD4_D 31
#define COLUMN_JOYPAD4_L 32
#define COLUMN_JOYPAD4_R 33
#define COLUMN_FRAMENUM2 34
#define NUM_JOYPADS 4
#define NUM_JOYPAD_BUTTONS 8
// listview column names
#define COLUMN_ARROW 0
#define COLUMN_FRAMENUM 1
#define COLUMN_JOYPAD1_A 2
#define COLUMN_JOYPAD1_B 3
#define COLUMN_JOYPAD1_S 4
#define COLUMN_JOYPAD1_T 5
#define COLUMN_JOYPAD1_U 6
#define COLUMN_JOYPAD1_D 7
#define COLUMN_JOYPAD1_L 8
#define COLUMN_JOYPAD1_R 9
#define COLUMN_JOYPAD2_A 10
#define COLUMN_JOYPAD2_B 11
#define COLUMN_JOYPAD2_S 12
#define COLUMN_JOYPAD2_T 13
#define COLUMN_JOYPAD2_U 14
#define COLUMN_JOYPAD2_D 15
#define COLUMN_JOYPAD2_L 16
#define COLUMN_JOYPAD2_R 17
#define COLUMN_JOYPAD3_A 18
#define COLUMN_JOYPAD3_B 19
#define COLUMN_JOYPAD3_S 20
#define COLUMN_JOYPAD3_T 21
#define COLUMN_JOYPAD3_U 22
#define COLUMN_JOYPAD3_D 23
#define COLUMN_JOYPAD3_L 24
#define COLUMN_JOYPAD3_R 25
#define COLUMN_JOYPAD4_A 26
#define COLUMN_JOYPAD4_B 27
#define COLUMN_JOYPAD4_S 28
#define COLUMN_JOYPAD4_T 29
#define COLUMN_JOYPAD4_U 30
#define COLUMN_JOYPAD4_D 31
#define COLUMN_JOYPAD4_L 32
#define COLUMN_JOYPAD4_R 33
#define COLUMN_FRAMENUM2 34
// listview colors
#define NORMAL_FRAMENUM_COLOR 0xFFFFFF
#define CUR_FRAMENUM_COLOR 0xFCF1CE
#define GREENZONE_FRAMENUM_COLOR 0xDCFFDC
#define LAG_FRAMENUM_COLOR 0xDAD9FE
#define NORMAL_INPUT_COLOR1 0xF0F0F0
#define CUR_INPUT_COLOR1 0xFBEDB7
#define GREENZONE_INPUT_COLOR1 0xC3FFC3
#define LAG_INPUT_COLOR1 0xC9C3FF
#define NORMAL_INPUT_COLOR2 0xDEDEDE
#define CUR_INPUT_COLOR2 0xE4D8A8
#define GREENZONE_INPUT_COLOR2 0xAEE2AE
#define LAG_INPUT_COLOR2 0xAFAADC
// -----------------------------
void DoTasEdit();
void UpdateTasEdit();
void CreateProject(MovieData data);
void InvalidateGreenZone(int after);
bool JumpToFrame(int index);

View File

@ -654,10 +654,10 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDIT },
{ EMUCMD_HIDE_MENU_TOGGLE, EMUCMDTYPE_MISC, FCEUD_HideMenuToggle, 0, 0, "Hide Menu Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_EXIT, EMUCMDTYPE_MISC, FCEUI_DoExit, 0, 0, "Exit", 0},
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", 0 },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", 0 },
{ EMUCMD_SPEED_NORMAL, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Normal Speed", 0 },
{ EMUCMD_SPEED_FASTER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Up", 0 },
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_NORMAL, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Normal Speed", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_FASTER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Up", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_FASTEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Fastest Speed", 0 },
{ EMUCMD_SPEED_TURBO, EMUCMDTYPE_SPEED, FCEUD_TurboOn, FCEUD_TurboOff, 0, "Turbo", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SPEED_TURBO_TOGGLE, EMUCMDTYPE_SPEED, FCEUD_TurboToggle, 0, 0, "Turbo Toggle", EMUCMDFLAG_TASEDIT },
@ -704,19 +704,19 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_MOVIE_PLAY_FROM_BEGINNING, EMUCMDTYPE_MOVIE, FCEUI_MoviePlayFromBeginning, 0, 0, "Play Movie From Beginning", 0 },
{ EMUCMD_MOVIE_STOP, EMUCMDTYPE_MOVIE, FCEUI_StopMovie, 0, 0, "Stop Movie", 0 },
{ EMUCMD_MOVIE_READONLY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleReadOnly, 0, 0, "Toggle Read-Only", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Frame Display Toggle", 0 },
{ EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE, EMUCMDTYPE_MOVIE, FCEUI_MovieToggleFrameDisplay, 0, 0, "Frame Display Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_ToggleInputDisplay, 0, 0, "Toggle Input Display", 0 },
{ EMUCMD_MOVIE_INPUT_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_ToggleInputDisplay, 0, 0, "Toggle Input Display", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUD_ToggleStatusIcon, 0, 0, "Toggle Status Icon", 0 },
#ifdef _S9XLUA_H
{ EMUCMD_SCRIPT_RELOAD, EMUCMDTYPE_MISC, FCEU_ReloadLuaCode, 0, 0, "Reload current Lua script", },
{ EMUCMD_SCRIPT_RELOAD, EMUCMDTYPE_MISC, FCEU_ReloadLuaCode, 0, 0, "Reload current Lua script", 0 },
#endif
{ EMUCMD_SOUND_TOGGLE, EMUCMDTYPE_SOUND, FCEUD_SoundToggle, 0, 0, "Sound Mute Toggle", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SOUND_VOLUME_UP, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Up", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SOUND_VOLUME_DOWN, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Down", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SOUND_VOLUME_NORMAL, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Normal", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SOUND_VOLUME_UP, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Up", 0 },
{ EMUCMD_SOUND_VOLUME_DOWN, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Down", 0 },
{ EMUCMD_SOUND_VOLUME_NORMAL, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Normal", 0 },
{ EMUCMD_AVI_RECORD_AS, EMUCMDTYPE_AVI, FCEUD_AviRecordTo, 0, 0, "Record AVI As...", 0 },
{ EMUCMD_AVI_STOP, EMUCMDTYPE_AVI, FCEUD_AviStop, 0, 0, "Stop AVI", 0 },
@ -737,12 +737,12 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_VSUNI_TOGGLE_DIP_9, EMUCMDTYPE_VSUNI, CommandToggleDip, 0, 0, "Toggle Dipswitch 9", 0 },
{ EMUCMD_MISC_AUTOSAVE, EMUCMDTYPE_MISC, FCEUI_Autosave, 0, 0, "Load Last Auto-save", 0},
{ EMUCMD_MISC_SHOWSTATES, EMUCMDTYPE_MISC, ViewSlots, 0, 0, "View save slots", 0 },
{ EMUCMD_MISC_USE_INPUT_PRESET_1, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 1", 0 },
{ EMUCMD_MISC_USE_INPUT_PRESET_2, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 2", 0 },
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", 0 },
{ EMUCMD_MISC_USE_INPUT_PRESET_1, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 1", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_USE_INPUT_PRESET_2, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 2", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", EMUCMDFLAG_TASEDIT },
{ EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background 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", 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_OPENCHEATS, EMUCMDTYPE_TOOL, LaunchCheats, 0, 0, "Open Cheats", 0},

View File

@ -1217,7 +1217,7 @@ void FCEUMOV_AddCommand(int cmd)
void FCEU_DrawMovies(uint8 *XBuf)
{
if(frame_display && movieMode != MOVIEMODE_TASEDIT)
if(frame_display)
{
char counterbuf[32] = {0};
int color = 0x20;
@ -1229,8 +1229,10 @@ void FCEU_DrawMovies(uint8 *XBuf)
{
sprintf(counterbuf,"%d/%d (finished)",currFrameCounter,currMovieData.records.size());
color = 0x17; //Show red to get attention
}
else
} else if(movieMode == MOVIEMODE_TASEDIT)
{
sprintf(counterbuf,"%d",currFrameCounter);
} else
sprintf(counterbuf,"%d (no movie)",currFrameCounter);
if(counterbuf[0])