* Tasedit: History truncates after making different commit at the middle of History

* Tasedit: Config->Branches work only when Recording
* Switching Tasedit Bg input on/off when Tasedit gets/loses focus (allows FCEUX control without "Bg input")
This commit is contained in:
ansstuff 2011-10-28 16:04:03 +00:00
parent ca24e7b8a5
commit 8daf0314b0
10 changed files with 66 additions and 29 deletions

View File

@ -73,6 +73,7 @@ extern bool TASEdit_show_lag_frames;
extern bool TASEdit_show_markers;
extern bool TASEdit_bind_markers;
extern bool TASEdit_branch_full_movie;
extern bool TASEdit_branch_only_when_rec;
extern bool TASEdit_restore_position;
extern bool TASEdit_show_dot;
extern int TASEdit_greenzone_capacity;
@ -300,6 +301,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(TASEdit_show_markers),
AC(TASEdit_bind_markers),
AC(TASEdit_branch_full_movie),
AC(TASEdit_branch_only_when_rec),
AC(TASEdit_restore_position),
AC(TASEdit_show_dot),
AC(TASEdit_greenzone_capacity),

View File

@ -262,9 +262,12 @@ BEGIN
MENUITEM "Set &greenzone capacity", ID_CONFIG_SETGREENZONECAPACITY
MENUITEM "Set max undo levels", ID_CONFIG_SETMAXUNDOLEVELS
MENUITEM SEPARATOR
MENUITEM "Mute &Turbo", ID_CONFIG_MUTETURBO
MENUITEM "&Bind Markers to Input", ID_CONFIG_BINDMARKERSTOINPUT
MENUITEM "Branches restore entire Movie", ID_CONFIG_BRANCHESRESTOREFULLMOVIE
MENUITEM "Branches work only when Recording", ID_CONFIG_BRANCHESWORKONLYWHENRECORDING
MENUITEM SEPARATOR
MENUITEM "&Bind Markers to Input", ID_CONFIG_BINDMARKERSTOINPUT
MENUITEM SEPARATOR
MENUITEM "Mute &Turbo", ID_CONFIG_MUTETURBO
END
POPUP "&Help"
BEGIN
@ -1372,8 +1375,8 @@ BEGIN
GROUPBOX " Bookmarks ",IDC_BOOKMARKS_BOX,310,158,123,103,BS_CENTER,WS_EX_RIGHT
CONTROL "",IDC_BOOKMARKSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOSCROLL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER,315,168,113,89
CONTROL "",IDC_HISTORYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_OWNERDATA | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER,315,273,113,99
CONTROL " OFF",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,316,78,29,10
CONTROL " ON",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,316,91,29,10
CONTROL " OFF",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,316,78,27,10
CONTROL " ON",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,316,91,27,10
CONTROL " 1P",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,373,78,25,10
CONTROL " 2P",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,402,78,23,10
CONTROL " 3P",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,373,91,25,10

View File

@ -871,6 +871,7 @@
#define ID_VIEW_X 40471
#define ID_VIEW_JUMPWHENMAKINGUNDO 40472
#define ID_CONFIG_BRANCHESRESTOREFULLMOVIE 40473
#define ID_CONFIG_BRANCHESWORKONLYWHENRECORDING 40474
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426
@ -880,7 +881,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 173
#define _APS_NEXT_COMMAND_VALUE 40474
#define _APS_NEXT_COMMAND_VALUE 40475
#define _APS_NEXT_CONTROL_VALUE 1265
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -38,6 +38,7 @@ bool TASEdit_show_lag_frames = true;
bool TASEdit_show_markers = true;
bool TASEdit_bind_markers = true;
bool TASEdit_branch_full_movie = true;
bool TASEdit_branch_only_when_rec = false;
bool TASEdit_restore_position = false;
int TASEdit_greenzone_capacity = GREENZONE_CAPACITY_DEFAULT;
extern bool muteTurbo;
@ -286,7 +287,7 @@ void UpdateTasEdit()
project.update();
// update Bookmarks/Branches groupbox caption
if (old_movie_readonly != movie_readonly)
if (TASEdit_branch_only_when_rec && old_movie_readonly != movie_readonly)
bookmarks.RedrawBookmarksCaption();
// update recording radio buttons if user used hotkey to switch R/W
@ -1421,10 +1422,10 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_ACTIVATEAPP:
if((BOOL)wParam)
TASEdit_focus = true;
GotFocus();
else
TASEdit_focus = false;
return DefWindowProc(hwndDlg,uMsg,wParam,lParam);
LostFocus();
break;
case WM_COMMAND:
switch(LOWORD(wParam))
@ -1614,6 +1615,12 @@ BOOL CALLBACK WndprocTasEdit(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TASEdit_branch_full_movie ^= 1;
CheckMenuItem(hmenu, ID_CONFIG_BRANCHESRESTOREFULLMOVIE, TASEdit_branch_full_movie?MF_CHECKED : MF_UNCHECKED);
break;
case ID_CONFIG_BRANCHESWORKONLYWHENRECORDING:
//switch "Branches work only when Recording" flag
TASEdit_branch_only_when_rec ^= 1;
CheckMenuItem(hmenu, ID_CONFIG_BRANCHESWORKONLYWHENRECORDING, TASEdit_branch_only_when_rec?MF_CHECKED : MF_UNCHECKED);
bookmarks.RedrawBookmarksCaption();
break;
case IDC_PROGRESS_BUTTON:
// click on progressbar - stop seeking
if (playback.pauseframe) playback.SeekingStop();
@ -1800,11 +1807,9 @@ void EnterTasEdit()
{
// save "eoptions"
saved_eoptions = eoptions;
// clear "Run in background"
eoptions &= ~EO_BGRUN;
// set "Background TASEdit input"
KeyboardSetBackgroundAccessBit(KEYBACKACCESS_TASEDIT);
JoystickSetBackgroundAccessBit(JOYBACKACCESS_TASEDIT);
// set "Run in background"
eoptions |= EO_BGRUN;
GotFocus();
// "Set high-priority thread"
eoptions |= EO_HIGHPRIO;
DoPriority();
@ -1826,6 +1831,7 @@ void EnterTasEdit()
CheckMenuItem(hmenu, ID_VIEW_JUMPWHENMAKINGUNDO, TASEdit_jump_to_undo?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_BINDMARKERSTOINPUT, TASEdit_bind_markers?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_BRANCHESRESTOREFULLMOVIE, TASEdit_branch_full_movie?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_BRANCHESWORKONLYWHENRECORDING, TASEdit_branch_only_when_rec?MF_CHECKED : MF_UNCHECKED);
CheckDlgButton(hwndTasEdit,CHECK_AUTORESTORE_PLAYBACK,TASEdit_restore_position?BST_CHECKED:BST_UNCHECKED);
CheckMenuItem(hmenu, ID_CONFIG_MUTETURBO, muteTurbo?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_SHOWDOTINEMPTYCELLS, TASEdit_show_dot?MF_CHECKED : MF_UNCHECKED);
@ -2002,3 +2008,18 @@ bool ExitTasEdit()
return true;
}
void GotFocus()
{
TASEdit_focus = true;
// set "Background TASEdit input"
KeyboardSetBackgroundAccessBit(KEYBACKACCESS_TASEDIT);
JoystickSetBackgroundAccessBit(JOYBACKACCESS_TASEDIT);
}
void LostFocus()
{
TASEdit_focus = false;
// clear "Background TASEdit input"
KeyboardClearBackgroundAccessBit(KEYBACKACCESS_TASEDIT);
JoystickClearBackgroundAccessBit(JOYBACKACCESS_TASEDIT);
}

View File

@ -136,3 +136,6 @@ void ColumnSet(int column);
bool Copy();
void Cut();
bool Paste();
void GotFocus();
void LostFocus();

View File

@ -30,6 +30,7 @@ extern HWND hwndBookmarksList;
extern bool TASEdit_show_lag_frames;
extern bool TASEdit_bind_markers;
extern bool TASEdit_branch_full_movie;
extern bool TASEdit_branch_only_when_rec;
BOOKMARKS::BOOKMARKS()
{
@ -90,7 +91,6 @@ void BOOKMARKS::set(int slot)
RedrawRow(currFrameCounter);
RedrawBookmarksRow((slot + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
void BOOKMARKS::jump(int slot)
@ -110,7 +110,7 @@ void BOOKMARKS::jump(int slot)
void BOOKMARKS::unleash(int slot)
{
if (movie_readonly)
if (TASEdit_branch_only_when_rec && movie_readonly)
{
jump(slot);
return;
@ -235,7 +235,10 @@ bool BOOKMARKS::load(EMUFILE *is)
// ----------------------------------------------------------
void BOOKMARKS::RedrawBookmarksCaption()
{
SetWindowText(hwndBookmarks, bookmarksCaption[(movie_readonly)?0:1]);
if (TASEdit_branch_only_when_rec)
SetWindowText(hwndBookmarks, bookmarksCaption[(movie_readonly)?0:1]);
else
SetWindowText(hwndBookmarks, bookmarksCaption[1]);
RedrawBookmarksList();
}
void BOOKMARKS::RedrawBookmarksList()
@ -300,7 +303,7 @@ LONG BOOKMARKS::CustomDraw(NMLVCUSTOMDRAW* msg)
if (bookmarks_array[cell_y].flash_phase)
msg->clrText = bookmark_flash_colors[bookmarks_array[cell_y].flash_type][bookmarks_array[cell_y].flash_phase];
if (cell_x == BOOKMARKS_COLUMN_FRAME || (movie_readonly && cell_x == BOOKMARKS_COLUMN_TIME))
if (cell_x == BOOKMARKS_COLUMN_FRAME || (TASEdit_branch_only_when_rec && movie_readonly && cell_x == BOOKMARKS_COLUMN_TIME))
{
if (bookmarks_array[cell_y].not_empty)
{
@ -374,11 +377,10 @@ void BOOKMARKS::LeftClick(LPNMITEMACTIVATE info)
int cell_y = info->iItem;
if (cell_y >= 0 && cell_x >= 0)
{
if (cell_x <= BOOKMARKS_COLUMN_FRAME || movie_readonly)
if (cell_x <= BOOKMARKS_COLUMN_FRAME || (TASEdit_branch_only_when_rec && movie_readonly))
jump((cell_y + 1) % TOTAL_BOOKMARKS);
else if (cell_x == BOOKMARKS_COLUMN_TIME && !movie_readonly)
else if (cell_x == BOOKMARKS_COLUMN_TIME && (!TASEdit_branch_only_when_rec || !movie_readonly))
unleash((cell_y + 1) % TOTAL_BOOKMARKS);
//RedrawBookmarksList();
}
// remove selection
ListView_SetItemState(hwndBookmarksList, -1, 0, LVIS_FOCUSED|LVIS_SELECTED);

View File

@ -179,9 +179,14 @@ void INPUT_HISTORY::AddInputSnapshotToHistory(INPUT_SNAPSHOT &inp)
{
// overwrite old snapshot
real_pos = (history_start_pos + history_cursor_pos) % history_size;
// compare with the snapshot we're going to overwrite, if it's different then break the chain of coherent snapshots
// compare with the snapshot we're going to overwrite, if it's different then truncate history after this item
if (input_snapshots[real_pos].checkDiff(inp) || input_snapshots[real_pos].checkMarkersDiff(inp))
{
history_total_items = history_cursor_pos+1;
UpdateHistoryList();
} else
{
// it's not different - don't truncate history, but break the chain of coherent snapshots
for (int i = history_cursor_pos+1; i < history_total_items; ++i)
{
real_pos = (history_start_pos + i) % history_size;
@ -190,7 +195,7 @@ void INPUT_HISTORY::AddInputSnapshotToHistory(INPUT_SNAPSHOT &inp)
}
} else
{
// add new smapshot
// add new snapshot
history_total_items = history_cursor_pos+1;
UpdateHistoryList();
}
@ -397,9 +402,9 @@ LONG INPUT_HISTORY::CustomDraw(NMLVCUSTOMDRAW* msg)
case CDDS_ITEMPREPAINT:
{
if (GetItemCoherence(msg->nmcd.dwItemSpec))
msg->clrTextBk = HISTORY_COHERENT_COLOR;
msg->clrText = HISTORY_NORMAL_COLOR;
else
msg->clrTextBk = HISTORY_NORMAL_COLOR;
msg->clrText = HISTORY_INCOHERENT_COLOR;
}
default:
return CDRF_DODEFAULT;

View File

@ -39,8 +39,8 @@
#define MODTYPE_MARKER_SET 34
#define MODTYPE_MARKER_UNSET 35
#define HISTORY_COHERENT_COLOR 0xF9DDE6
#define HISTORY_NORMAL_COLOR 0xFFFFFF
#define HISTORY_NORMAL_COLOR 0x000000
#define HISTORY_INCOHERENT_COLOR 0x999999
#define HISTORY_ID_LEN 8

View File

@ -43,7 +43,7 @@ public:
std::vector<uint8> hot_changes; // Format: buttons01joy0-for-frame0, buttons23joy0-for-frame0, buttons45joy0-for-frame0, buttons67joy0-for-frame0, buttons01joy1-for-frame0, ...
std::vector<uint8> markers_array; // just a copy of markers.markers_array
bool coherent; // indicates whether this state was made by inputchange of previous state
bool coherent; // indicates whether this state was made right after previous state
int jump_frame; // for jumping when making undo
char description[SNAPSHOT_DESC_MAX_LENGTH];

View File

@ -2376,7 +2376,7 @@ void UpdateFCEUWindow(void)
if(!(eoptions & EO_BGRUN))
{
while(nofocus && !TASEdit_focus)
while(nofocus)
{
Sleep(75);