* "Play Movie" dialog doesn't search in fceux root folder anymore

* Taseditor: padding movie when drawing input down
* Taseditor: rightclicks in Branches Tree
This commit is contained in:
ansstuff 2012-04-14 14:06:34 +00:00
parent 6761bc431e
commit d27e7bf2b1
17 changed files with 274 additions and 169 deletions

View File

@ -1,4 +1,9 @@
14-Apr-2012 - AnS - Taseditor: rightclicks in Branches Tree
14-Apr-2012 - AnS - "Play Movie" dialog doesn't search in fceux root folder anymore
10-Apr-2012 - AnS - bold items in some context menus
10-apr-2012 - zeromus - fix mapper 115 (actually to fix mapper 248 for Bao Qing Tian)
09-apr-2012 - zeromus - remove vram protection from mapper 227
09-Apr-2012 - AnS - Taseditor: all GUI buttons fire off at mousedown; disabled Spacebar and enabled Middle mouse button on GUI buttons
09-Apr-2012 - AnS - Taseditor: clicks in Branches Tree
07-Apr-2012 - AnS - Taseditor: version data in fm3

View File

@ -505,12 +505,13 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
SendDlgItemMessage(hwndDlg, IDC_CHECK_READONLY, BM_SETCHECK, replayReadOnlySetting?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hwndDlg, IDC_CHECK_STOPMOVIE,BM_SETCHECK, BST_UNCHECKED, 0);
char* findGlob[2] = {strdup(FCEU_MakeFName(FCEUMKF_MOVIEGLOB, 0, 0).c_str()),
strdup(FCEU_MakeFName(FCEUMKF_MOVIEGLOB2, 0, 0).c_str())};
#define NUM_OF_MOVIEGLOB_PATHS 1
char* findGlob[NUM_OF_MOVIEGLOB_PATHS] = {strdup(FCEU_MakeFName(FCEUMKF_MOVIEGLOB, 0, 0).c_str())};
int items=0;
for(int j=0;j<2;j++)
for(int j = 0;j < NUM_OF_MOVIEGLOB_PATHS; j++)
{
char* temp=0;
do {
@ -524,10 +525,7 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
// findGlob[j][i] = tolower(findGlob[j][i]);
}
// FCEU_PrintError(findGlob[0]);
// FCEU_PrintError(findGlob[1]);
for(int j=0;j<2;j++)
for(int j = 0;j < NUM_OF_MOVIEGLOB_PATHS; j++)
{
// if the two directories are the same, only look through one of them to avoid adding everything twice
if(j==1 && !strnicmp(findGlob[0],findGlob[1],MAX(strlen(findGlob[0]),strlen(findGlob[1]))-6))
@ -599,8 +597,8 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
}
}
free(findGlob[0]);
free(findGlob[1]);
for(int j = 0; j < NUM_OF_MOVIEGLOB_PATHS; j++)
free(findGlob[j]);
if(items>0)
SendDlgItemMessage(hwndDlg, IDC_COMBO_FILENAME, CB_SETCURSEL, items-1, 0);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -109,7 +109,7 @@ bool EnterTasEditor()
// create new movie
FCEUI_StopMovie();
movieMode = MOVIEMODE_TASEDITOR;
CreateCleanMovie();
FCEUMOV_CreateCleanMovie();
playback.StartFromZero();
} else
{
@ -171,7 +171,7 @@ bool ExitTasEditor()
// switch off taseditor mode
movieMode = MOVIEMODE_INACTIVE;
FCEU_DispMessage("TAS Editor disengaged", 0);
CreateCleanMovie();
FCEUMOV_CreateCleanMovie();
return true;
}
@ -308,7 +308,7 @@ void NewProject()
static struct NewProjectParameters params;
if (DialogBoxParam(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_NEWPROJECT), taseditor_window.hwndTasEditor, NewProjectProc, (LPARAM)&params) > 0)
{
CreateCleanMovie();
FCEUMOV_CreateCleanMovie();
// apply selected options
SetInputType(currMovieData, params.input_type);

View File

@ -37,7 +37,7 @@ void BOOKMARK::init()
void BOOKMARK::free()
{
not_empty = false;
flash_type = flash_phase = 0;
flash_type = flash_phase = floating_phase = 0;
SNAPSHOT tmp;
snapshot = tmp;
savestate.resize(0);
@ -139,8 +139,8 @@ bool BOOKMARK::load(EMUFILE *is)
{
free();
}
// all ok
flash_type = flash_phase = 0;
// all ok - reset vars
flash_type = flash_phase = floating_phase = 0;
return false;
}
bool BOOKMARK::skipLoad(EMUFILE *is)

View File

@ -39,6 +39,7 @@ public:
// not saved vars
int flash_phase;
int flash_type;
int floating_phase;
private:

View File

@ -132,7 +132,7 @@ void BOOKMARKS::reset_vars()
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
mouse_over_bitmap = false;
must_check_item_under_mouse = true;
bookmark_leftclicked = bookmark_rightclicked = -1;
bookmark_leftclicked = bookmark_rightclicked = ITEM_UNDER_MOUSE_NONE;
check_flash_shedule = clock() + BOOKMARKS_FLASH_TICK;
}
@ -188,9 +188,9 @@ void BOOKMARKS::update()
if (must_check_item_under_mouse)
{
if (edit_mode == EDIT_MODE_BRANCHES)
branches.FindItemUnderMouse(mouse_x, mouse_y);
item_under_mouse = branches.FindItemUnderMouse(mouse_x, mouse_y);
else if (edit_mode == EDIT_MODE_BOTH)
FindItemUnderMouse();
item_under_mouse = FindItemUnderMouse();
else
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
must_check_item_under_mouse = false;
@ -499,21 +499,26 @@ void BOOKMARKS::MouseMove(int new_x, int new_y)
mouse_y = new_y;
must_check_item_under_mouse = true;
}
void BOOKMARKS::FindItemUnderMouse()
int BOOKMARKS::FindItemUnderMouse()
{
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
int item = ITEM_UNDER_MOUSE_NONE;
RECT wrect;
GetClientRect(hwndBookmarksList, &wrect);
if (mouse_x >= list_row_left && mouse_x < wrect.right - wrect.left && mouse_y >= list_row_top && mouse_y < wrect.bottom - wrect.top)
{
item_under_mouse = (mouse_y - list_row_top) / list_row_height;
if (item_under_mouse >= 0 && item_under_mouse < TOTAL_BOOKMARKS)
{
item_under_mouse = (item_under_mouse + 1) % TOTAL_BOOKMARKS;
if (!bookmarks_array[item_under_mouse].not_empty)
item_under_mouse = ITEM_UNDER_MOUSE_NONE;
}
int row_under_mouse = (mouse_y - list_row_top) / list_row_height;
if (row_under_mouse >= 0 && row_under_mouse < TOTAL_BOOKMARKS)
item = (row_under_mouse + 1) % TOTAL_BOOKMARKS;
}
return item;
}
// this getter contains formula to decide whether it's safe to show Bookmarks Data now
bool BOOKMARKS::IsSafeToShowBookmarksData()
{
if (edit_mode == EDIT_MODE_BRANCHES && branches.transition_phase)
return false; // can't show data when Branches Tree is transforming
return true;
}
// ----------------------------------------------------------------------------------------
void BOOKMARKS::GetDispInfo(NMLVDISPINFO* nmlvDispInfo)
@ -756,7 +761,7 @@ LRESULT APIENTRY BookmarksListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
bookmarks.RightClick();
}
ReleaseCapture();
bookmarks.bookmark_rightclicked = -1;
bookmarks.bookmark_rightclicked = ITEM_UNDER_MOUSE_NONE;
return 0;
}
case WM_MBUTTONDOWN:
@ -768,9 +773,10 @@ LRESULT APIENTRY BookmarksListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
return 0;
}
case WM_MOUSEWHEEL:
bookmarks.bookmark_rightclicked = -1; // ensure that accidental rightclick on BookmarksList won't set Bookmarks when user does rightbutton + wheel
{
bookmarks.bookmark_rightclicked = ITEM_UNDER_MOUSE_NONE; // ensure that accidental rightclick on BookmarksList won't set Bookmarks when user does rightbutton + wheel
return SendMessage(piano_roll.hwndList, msg, wParam, lParam);
}
}
return CallWindowProc(hwndBookmarksList_oldWndProc, hWnd, msg, wParam, lParam);
}

View File

@ -72,7 +72,9 @@ public:
void RedrawListRow(int row_index);
void MouseMove(int new_x, int new_y);
void FindItemUnderMouse();
int FindItemUnderMouse();
bool IsSafeToShowBookmarksData();
// saved vars
std::vector<BOOKMARK> bookmarks_array;

View File

@ -46,7 +46,7 @@ extern COLORREF bookmark_flash_colors[TOTAL_COMMANDS][FLASH_PHASE_MAX+1];
// resources
// corners cursor animation
int corners_cursor_shift[BRANCHES_ANIMATION_FRAMES] = {0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0 };
int corners_cursor_shift[BRANCHES_ANIMATION_FRAMES] = {0, 0, 1, 1, 2, 2, 2, 2, 1, 1, 0, 0 };
BRANCHES::BRANCHES()
{
@ -85,7 +85,14 @@ void BRANCHES::init()
timeline_pen = CreatePen(PS_SOLID, 1, 0x0020E0);
select_pen = CreatePen(PS_SOLID, 2, 0xFF9080);
// set positions of slots to default coordinates
for (int i = TOTAL_BOOKMARKS; i >= 0; i--)
{
BranchX[i] = BranchPrevX[i] = BranchCurrX[i] = EMPTY_BRANCHES_X_BASE;
BranchY[i] = BranchPrevY[i] = BranchCurrY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
reset();
cursor_x = cursor_y = 0;
next_animation_time = 0;
update();
@ -167,16 +174,18 @@ void BRANCHES::reset()
cached_first_difference[i][t] = FIRST_DIFFERENCE_UNKNOWN;
}
reset_vars();
// set positions of slots to default coordinates
for (int i = TOTAL_BOOKMARKS; i >= 0; i--)
{
BranchX[i] = BranchPrevX[i] = BranchCurrX[i] = EMPTY_BRANCHES_X;
BranchY[i] = BranchPrevY[i] = BranchCurrY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
BranchPrevX[i] = BranchCurrX[i];
BranchPrevY[i] = BranchCurrY[i];
BranchX[i] = EMPTY_BRANCHES_X_BASE;
BranchY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
CloudX = CloudPrevX = BRANCHES_CLOUD_X;
cursor_x = cursor_y = 0;
reset_vars();
CloudPrevX = cloud_x;
CloudX = cloud_x = BRANCHES_CLOUD_X;
transition_phase = BRANCHES_TRANSITION_MAX;
current_branch = ITEM_UNDER_MOUSE_CLOUD;
changes_since_current_branch = false;
@ -190,6 +199,7 @@ void BRANCHES::reset_vars()
{
transition_phase = animation_frame = 0;
playback_x = playback_y = 0;
branch_rightclicked = latest_drawn_item_under_mouse = -1;
must_recalculate_branches_tree = must_redraw_branches_tree = true;
next_animation_time = clock() + BRANCHES_ANIMATION_TICK;
}
@ -199,7 +209,7 @@ void BRANCHES::update()
if (must_recalculate_branches_tree)
RecalculateBranchesTree();
// once per 50 milliseconds update branches_bitmap
// once per 40 milliseconds update branches_bitmap
if (clock() > next_animation_time)
{
// animate branches_bitmap
@ -207,6 +217,27 @@ void BRANCHES::update()
animation_frame = (animation_frame + 1) % BRANCHES_ANIMATION_FRAMES;
if (bookmarks.edit_mode == EDIT_MODE_BRANCHES)
{
// update floating "empty" branches
int floating_phase_target;
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
{
if (!bookmarks.bookmarks_array[i].not_empty)
{
if (i == bookmarks.item_under_mouse)
floating_phase_target = MAX_FLOATING_PHASE;
else
floating_phase_target = 0;
if (bookmarks.bookmarks_array[i].floating_phase > floating_phase_target)
{
bookmarks.bookmarks_array[i].floating_phase--;
must_redraw_branches_tree = true;
} else if (bookmarks.bookmarks_array[i].floating_phase < floating_phase_target)
{
bookmarks.bookmarks_array[i].floating_phase++;
must_redraw_branches_tree = true;
}
}
}
// grow or shrink fireball size
if (changes_since_current_branch)
{
@ -321,6 +352,12 @@ void BRANCHES::update()
cursor_x += dx * speed / distance;
cursor_y += dy * speed / distance;
}
if (latest_drawn_item_under_mouse != bookmarks.item_under_mouse)
{
must_redraw_branches_tree = true;
latest_drawn_item_under_mouse = bookmarks.item_under_mouse;
}
if (must_redraw_branches_tree)
RedrawBranchesTree();
}
@ -449,35 +486,38 @@ void BRANCHES::RedrawBranchesTree()
LineTo(hBitmapDC, branch_x, branch_y);
}
}
// lines for item under mouse
if (bookmarks.item_under_mouse >= 0 && bookmarks.item_under_mouse <= TOTAL_BOOKMARKS)
if (bookmarks.IsSafeToShowBookmarksData())
{
SelectObject(hBitmapDC, select_pen);
if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS)
branch = current_branch;
else
branch = FindFullTimelineForBranch(bookmarks.item_under_mouse);
while (branch >= 0)
// lines for item under mouse
if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS || (bookmarks.item_under_mouse >= 0 && bookmarks.item_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[bookmarks.item_under_mouse].not_empty))
{
branch_x = BranchCurrX[branch];
branch_y = BranchCurrY[branch];
MoveToEx(hBitmapDC, branch_x, branch_y, 0);
branch = parents[branch];
if (branch == ITEM_UNDER_MOUSE_CLOUD)
SelectObject(hBitmapDC, select_pen);
if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS)
branch = current_branch;
else
branch = FindFullTimelineForBranch(bookmarks.item_under_mouse);
while (branch >= 0)
{
branch_x = cloud_x;
branch_y = BRANCHES_CLOUD_Y;
} else
{
branch_x = BranchCurrX[branch];
branch_x = BranchCurrX[branch];
branch_y = BranchCurrY[branch];
MoveToEx(hBitmapDC, branch_x, branch_y, 0);
branch = parents[branch];
if (branch == ITEM_UNDER_MOUSE_CLOUD)
{
branch_x = cloud_x;
branch_y = BRANCHES_CLOUD_Y;
} else
{
branch_x = BranchCurrX[branch];
branch_y = BranchCurrY[branch];
}
LineTo(hBitmapDC, branch_x, branch_y);
}
LineTo(hBitmapDC, branch_x, branch_y);
}
}
if (changes_since_current_branch)
{
if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS)
if (bookmarks.IsSafeToShowBookmarksData() && bookmarks.item_under_mouse == TOTAL_BOOKMARKS)
SelectObject(hBitmapDC, select_pen);
else
SelectObject(hBitmapDC, timeline_pen);
@ -506,6 +546,11 @@ void BRANCHES::RedrawBranchesTree()
temp_rect.top = BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT;
temp_rect.right = temp_rect.left + DIGIT_RECT_WIDTH;
temp_rect.bottom = temp_rect.top + DIGIT_RECT_HEIGHT;
if (!bookmarks.bookmarks_array[i].not_empty && bookmarks.bookmarks_array[i].floating_phase > 0)
{
temp_rect.left += bookmarks.bookmarks_array[i].floating_phase;
temp_rect.right += bookmarks.bookmarks_array[i].floating_phase;
}
if (bookmarks.bookmarks_array[i].flash_phase)
{
// draw colored rect
@ -523,7 +568,7 @@ void BRANCHES::RedrawBranchesTree()
{
branch_x = BranchCurrX[i] - DIGIT_BITMAP_HALFWIDTH;
branch_y = BranchCurrY[i] - DIGIT_BITMAP_HALFHEIGHT;
if(i == current_branch)
if (i == current_branch)
{
if (i == bookmarks.item_under_mouse)
BitBlt(hBitmapDC, branch_x, branch_y, DIGIT_BITMAP_WIDTH, DIGIT_BITMAP_HEIGHT, hSpritesheetDC, i * DIGIT_BITMAP_WIDTH + BLUE_DIGITS_SPRITESHEET_DX, MOUSEOVER_DIGITS_SPRITESHEET_DY, SRCCOPY);
@ -531,48 +576,53 @@ void BRANCHES::RedrawBranchesTree()
BitBlt(hBitmapDC, branch_x, branch_y, DIGIT_BITMAP_WIDTH, DIGIT_BITMAP_HEIGHT, hSpritesheetDC, i * DIGIT_BITMAP_WIDTH + BLUE_DIGITS_SPRITESHEET_DX, 0, SRCCOPY);
} else
{
if (!bookmarks.bookmarks_array[i].not_empty && bookmarks.bookmarks_array[i].floating_phase > 0)
branch_x += bookmarks.bookmarks_array[i].floating_phase;
if (i == bookmarks.item_under_mouse)
BitBlt(hBitmapDC, branch_x, branch_y, DIGIT_BITMAP_WIDTH, DIGIT_BITMAP_HEIGHT, hSpritesheetDC, i * DIGIT_BITMAP_WIDTH, MOUSEOVER_DIGITS_SPRITESHEET_DY, SRCCOPY);
else
BitBlt(hBitmapDC, branch_x, branch_y, DIGIT_BITMAP_WIDTH, DIGIT_BITMAP_HEIGHT, hSpritesheetDC, i * DIGIT_BITMAP_WIDTH, 0, SRCCOPY);
}
}
SetBkMode(hBitmapDC, TRANSPARENT);
// jump_frame of item under cursor (except cloud - it doesn't have particular frame)
if (bookmarks.item_under_mouse > ITEM_UNDER_MOUSE_CLOUD)
if (bookmarks.IsSafeToShowBookmarksData())
{
char framenum_string[DIGITS_IN_FRAMENUM+1] = {0};
if (bookmarks.item_under_mouse < TOTAL_BOOKMARKS)
U32ToDecStr(framenum_string, bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.jump_frame, DIGITS_IN_FRAMENUM);
else
U32ToDecStr(framenum_string, currFrameCounter, DIGITS_IN_FRAMENUM);
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X + 1, BRANCHES_BITMAP_FRAMENUM_Y + 1, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X, BRANCHES_BITMAP_FRAMENUM_Y, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
}
// time of item under cursor
if (bookmarks.item_under_mouse > ITEM_UNDER_MOUSE_NONE)
{
if (bookmarks.item_under_mouse == ITEM_UNDER_MOUSE_CLOUD)
SetBkMode(hBitmapDC, TRANSPARENT);
// jump_frame of item under cursor (except cloud - it doesn't have particular frame)
if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS || (bookmarks.item_under_mouse >= 0 && bookmarks.item_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[bookmarks.item_under_mouse].not_empty))
{
// draw shadow of text
char framenum_string[DIGITS_IN_FRAMENUM+1] = {0};
if (bookmarks.item_under_mouse < TOTAL_BOOKMARKS)
U32ToDecStr(framenum_string, bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.jump_frame, DIGITS_IN_FRAMENUM);
else
U32ToDecStr(framenum_string, currFrameCounter, DIGITS_IN_FRAMENUM);
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X + 1, BRANCHES_BITMAP_FRAMENUM_Y + 1, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
} else if (bookmarks.item_under_mouse < TOTAL_BOOKMARKS)
TextOut(hBitmapDC, BRANCHES_BITMAP_FRAMENUM_X, BRANCHES_BITMAP_FRAMENUM_Y, (LPCSTR)framenum_string, DIGITS_IN_FRAMENUM);
}
// time of item under cursor
if (bookmarks.item_under_mouse > ITEM_UNDER_MOUSE_NONE)
{
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
} else // fireball - current_pos_time
{
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
if (bookmarks.item_under_mouse == ITEM_UNDER_MOUSE_CLOUD)
{
// draw shadow of text
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)cloud_time, TIME_DESC_LENGTH-1);
} else if (bookmarks.item_under_mouse == TOTAL_BOOKMARKS) // fireball - show current_pos_time
{
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)current_pos_time, TIME_DESC_LENGTH-1);
} else if (bookmarks.bookmarks_array[bookmarks.item_under_mouse].not_empty)
{
SetTextColor(hBitmapDC, BRANCHES_TEXT_SHADOW_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X + 1, BRANCHES_BITMAP_TIME_Y + 1, (LPCSTR)bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
SetTextColor(hBitmapDC, BRANCHES_TEXT_COLOR);
TextOut(hBitmapDC, BRANCHES_BITMAP_TIME_X, BRANCHES_BITMAP_TIME_Y, (LPCSTR)bookmarks.bookmarks_array[bookmarks.item_under_mouse].snapshot.description, TIME_DESC_LENGTH-1);
}
}
}
// finished
@ -601,7 +651,7 @@ void BRANCHES::PaintBranchesBitmap(HDC hdc)
}
}
// blinking Playback cursor point
if (animation_frame & 1)
if (animation_frame % 3)
TransparentBlt(hBufferDC, playback_x - BRANCHES_MINIARROW_HALFWIDTH, playback_y - BRANCHES_MINIARROW_HALFHEIGHT, BRANCHES_MINIARROW_WIDTH, BRANCHES_MINIARROW_HEIGHT, hSpritesheetDC, BRANCHES_MINIARROW_SPRITESHEET_X, BRANCHES_MINIARROW_SPRITESHEET_Y, BRANCHES_MINIARROW_WIDTH, BRANCHES_MINIARROW_HEIGHT, 0x00FF00);
// corners cursor
int current_corners_cursor_shift = BRANCHES_CORNER_BASE_SHIFT + corners_cursor_shift[animation_frame];
@ -758,19 +808,17 @@ void BRANCHES::ChangesMadeSinceBranch()
must_redraw_branches_tree = true; // to redraw fireball's time
}
void BRANCHES::FindItemUnderMouse(int mouse_x, int mouse_y)
int BRANCHES::FindItemUnderMouse(int mouse_x, int mouse_y)
{
int prev_item_under_mouse = bookmarks.item_under_mouse;
bookmarks.item_under_mouse = ITEM_UNDER_MOUSE_NONE;
int item = ITEM_UNDER_MOUSE_NONE;
for (int i = 0; i < TOTAL_BOOKMARKS; ++i)
if (bookmarks.item_under_mouse == ITEM_UNDER_MOUSE_NONE && bookmarks.bookmarks_array[i].not_empty && mouse_x >= BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
bookmarks.item_under_mouse = i;
if (bookmarks.item_under_mouse == ITEM_UNDER_MOUSE_NONE && mouse_x >= cloud_x - BRANCHES_CLOUD_HALFWIDTH && mouse_x < cloud_x - BRANCHES_CLOUD_HALFWIDTH + BRANCHES_CLOUD_WIDTH && mouse_y >= BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT && mouse_y < BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT + BRANCHES_CLOUD_HEIGHT)
bookmarks.item_under_mouse = ITEM_UNDER_MOUSE_CLOUD;
if (bookmarks.item_under_mouse == ITEM_UNDER_MOUSE_NONE && changes_since_current_branch && mouse_x >= BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
bookmarks.item_under_mouse = TOTAL_BOOKMARKS;
if (prev_item_under_mouse != bookmarks.item_under_mouse)
must_redraw_branches_tree = true;
if (item == ITEM_UNDER_MOUSE_NONE && mouse_x >= BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[i] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[i] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
item = i;
if (item == ITEM_UNDER_MOUSE_NONE && mouse_x >= cloud_x - BRANCHES_CLOUD_HALFWIDTH && mouse_x < cloud_x - BRANCHES_CLOUD_HALFWIDTH + BRANCHES_CLOUD_WIDTH && mouse_y >= BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT && mouse_y < BRANCHES_CLOUD_Y - BRANCHES_CLOUD_HALFHEIGHT + BRANCHES_CLOUD_HEIGHT)
item = ITEM_UNDER_MOUSE_CLOUD;
if (item == ITEM_UNDER_MOUSE_NONE && changes_since_current_branch && mouse_x >= BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION && mouse_x < BranchCurrX[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFWIDTH_COLLISION + DIGIT_RECT_WIDTH_COLLISION && mouse_y >= BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION && mouse_y < BranchCurrY[TOTAL_BOOKMARKS] - DIGIT_RECT_HALFHEIGHT_COLLISION + DIGIT_RECT_HEIGHT_COLLISION)
item = TOTAL_BOOKMARKS;
return item;
}
void BRANCHES::SetCurrentPosTime()
@ -786,16 +834,18 @@ void BRANCHES::RecalculateParents()
// find best parent for every Branch
std::vector<int> candidates;
int temp_jump_frame, temp_parent, max_jump_frame, max_first_difference;
for (int i = TOTAL_BOOKMARKS-1; i >= 0; i--)
for (int i1 = TOTAL_BOOKMARKS-1; i1 >= 0; i1--)
{
int i = (i1 + 1) % TOTAL_BOOKMARKS;
if (bookmarks.bookmarks_array[i].not_empty)
{
int jump_frame = bookmarks.bookmarks_array[i].snapshot.jump_frame;
// 1 - find all candidates and max_jump_frame among them
candidates.resize(0);
max_jump_frame = -1;
for (int t = TOTAL_BOOKMARKS-1; t >= 0; t--)
for (int t1 = TOTAL_BOOKMARKS-1; t1 >= 0; t1--)
{
int t = (t1 + 1) % TOTAL_BOOKMARKS;
temp_jump_frame = bookmarks.bookmarks_array[t].snapshot.jump_frame;
if (t != i && bookmarks.bookmarks_array[t].not_empty && temp_jump_frame <= jump_frame && GetFirstDifference(t, i) >= temp_jump_frame)
{
@ -865,9 +915,9 @@ void BRANCHES::RecalculateBranchesTree()
std::vector<std::vector<int>> BranchesLevels;
std::vector<uint8> UndistributedBranches;
UndistributedBranches.resize(TOTAL_BOOKMARKS);
UndistributedBranches.resize(TOTAL_BOOKMARKS); // 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
for (int i = UndistributedBranches.size()-1; i >= 0; i--)
UndistributedBranches[i] = i;
UndistributedBranches[i] = (i + 1) % TOTAL_BOOKMARKS;
// remove all empty branches
for (int i = UndistributedBranches.size()-1; i >= 0; i--)
{
@ -979,7 +1029,7 @@ void BRANCHES::RecalculateBranchesTree()
GridY[TOTAL_BOOKMARKS] -= 2;
}
}
// special case 3: if some branch crosses upper or lower border
// special case 3: if some branch crosses upper or lower border of canvas
int parent;
for (int t = TOTAL_BOOKMARKS; t >= 0; t--)
{
@ -1051,7 +1101,7 @@ void BRANCHES::RecalculateBranchesTree()
BranchY[i] = BRANCHES_CLOUD_Y + GridY[i] * grid_halfheight;
} else
{
BranchX[i] = EMPTY_BRANCHES_X;
BranchX[i] = EMPTY_BRANCHES_X_BASE;
BranchY[i] = EMPTY_BRANCHES_Y_BASE + EMPTY_BRANCHES_Y_FACTOR * ((i + TOTAL_BOOKMARKS - 1) % TOTAL_BOOKMARKS);
}
if (max_x < BranchX[i]) max_x = BranchX[i];
@ -1072,8 +1122,9 @@ void BRANCHES::RecalculateBranchesTree()
}
if (max_x < BranchX[TOTAL_BOOKMARKS]) max_x = BranchX[TOTAL_BOOKMARKS];
// align whole tree horizontally
CloudX = (BRANCHES_BITMAP_WIDTH + 1 - max_x) / 2;
if (CloudX < 0) CloudX = 0;
CloudX = (BRANCHES_BITMAP_WIDTH + BASE_HORIZONTAL_SHIFT - max_x) / 2;
if (CloudX < MIN_CLOUD_X)
CloudX = MIN_CLOUD_X;
for (int i = TOTAL_BOOKMARKS-1; i >= 0; i--)
if (bookmarks.bookmarks_array[i].not_empty)
BranchX[i] += CloudX;
@ -1186,6 +1237,18 @@ LRESULT APIENTRY BranchesBitmapWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
{
if (GetFocus() != hWnd)
SetFocus(hWnd);
branches.branch_rightclicked = branches.FindItemUnderMouse(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
if (branches.branch_rightclicked >= 0 && branches.branch_rightclicked < TOTAL_BOOKMARKS)
SetCapture(hWnd);
return 0;
}
case WM_RBUTTONUP:
{
if (branches.branch_rightclicked >= 0 && branches.branch_rightclicked < TOTAL_BOOKMARKS
&& branches.branch_rightclicked == branches.FindItemUnderMouse(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)))
bookmarks.command(COMMAND_SET, branches.branch_rightclicked);
ReleaseCapture();
branches.branch_rightclicked = ITEM_UNDER_MOUSE_NONE;
return 0;
}
case WM_MBUTTONDOWN:
@ -1197,8 +1260,10 @@ LRESULT APIENTRY BranchesBitmapWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA
return 0;
}
case WM_MOUSEWHEEL:
{
branches.branch_rightclicked = ITEM_UNDER_MOUSE_NONE; // ensure that accidental rightclick on BookmarksList won't set Bookmarks when user does rightbutton + wheel
return SendMessage(piano_roll.hwndList, msg, wParam, lParam);
}
}
return CallWindowProc(hwndBranchesBitmap_oldWndProc, hWnd, msg, wParam, lParam);
}

View File

@ -1,11 +1,14 @@
// Specification file for Branches class
#define BRANCHES_ANIMATION_TICK 50 // animate at 20FPS
#define BRANCHES_TRANSITION_MAX 8
#define BRANCHES_ANIMATION_TICK 40 // animate at 25FPS
#define BRANCHES_TRANSITION_MAX 12
#define CURSOR_MIN_DISTANCE 1.0
#define CURSOR_MAX_DISTANCE 256.0
#define CURSOR_MIN_SPEED 1.0
// floating "empty" branches
#define MAX_FLOATING_PHASE 4
// branches bitmap
#define BRANCHES_BITMAP_WIDTH 170
#define BRANCHES_BITMAP_HEIGHT 145
@ -17,17 +20,19 @@
#define BRANCHES_TEXT_SHADOW_COLOR 0xFFFFFF
#define BRANCHES_TEXT_COLOR 0x7F0000
// constants for drawing branches tree
#define BRANCHES_CANVAS_WIDTH 146
#define BRANCHES_CANVAS_WIDTH 140
#define BRANCHES_CANVAS_HEIGHT 130
#define BRANCHES_CLOUD_X 14
#define BRANCHES_CLOUD_Y 72
#define BRANCHES_GRID_MIN_WIDTH 14
#define BRANCHES_GRID_MAX_WIDTH 30
#define MIN_CLOUD_LINE_LENGTH 19
#define MIN_CLOUD_X 12
#define BASE_HORIZONTAL_SHIFT 10
#define BRANCHES_GRID_MIN_HALFHEIGHT 8
#define BRANCHES_GRID_MAX_HALFHEIGHT 12
#define EMPTY_BRANCHES_X -6
#define EMPTY_BRANCHES_Y_BASE 8
#define EMPTY_BRANCHES_X_BASE 3
#define EMPTY_BRANCHES_Y_BASE 9
#define EMPTY_BRANCHES_Y_FACTOR 14
#define MAX_NUM_CHILDREN_ON_CANVAS_HEIGHT 9
#define MAX_CHAIN_LEN 10
@ -61,19 +66,19 @@
#define BRANCHES_FIREBALL_SPRITESHEET_Y 26
#define BRANCHES_FIREBALL_MAX_SIZE 5
#define BRANCHES_FIREBALL_SPRITESHEET_END_X 160
#define BRANCHES_CORNER_WIDTH 7
#define BRANCHES_CORNER_WIDTH 6
#define BRANCHES_CORNER_HALFWIDTH BRANCHES_CORNER_WIDTH/2
#define BRANCHES_CORNER_HEIGHT 7
#define BRANCHES_CORNER_HEIGHT 6
#define BRANCHES_CORNER_HALFHEIGHT BRANCHES_CORNER_HEIGHT/2
#define BRANCHES_CORNER1_SPRITESHEET_X 206
#define BRANCHES_CORNER1_SPRITESHEET_Y 0
#define BRANCHES_CORNER2_SPRITESHEET_X 213
#define BRANCHES_CORNER2_SPRITESHEET_X 212
#define BRANCHES_CORNER2_SPRITESHEET_Y 0
#define BRANCHES_CORNER3_SPRITESHEET_X 206
#define BRANCHES_CORNER3_SPRITESHEET_Y 7
#define BRANCHES_CORNER4_SPRITESHEET_X 213
#define BRANCHES_CORNER4_SPRITESHEET_Y 7
#define BRANCHES_CORNER_BASE_SHIFT 5
#define BRANCHES_CORNER3_SPRITESHEET_Y 6
#define BRANCHES_CORNER4_SPRITESHEET_X 212
#define BRANCHES_CORNER4_SPRITESHEET_Y 6
#define BRANCHES_CORNER_BASE_SHIFT 7
#define BRANCHES_MINIARROW_SPRITESHEET_X 180
#define BRANCHES_MINIARROW_SPRITESHEET_Y 15
#define BRANCHES_MINIARROW_WIDTH 3
@ -111,7 +116,7 @@ public:
int FindFullTimelineForBranch(int branch_num);
void ChangesMadeSinceBranch();
void FindItemUnderMouse(int mouse_x, int mouse_y);
int FindItemUnderMouse(int mouse_x, int mouse_y);
void RecalculateParents();
void RecalculateBranchesTree();
@ -125,6 +130,8 @@ public:
// not saved vars
bool must_redraw_branches_tree;
bool must_recalculate_branches_tree;
int branch_rightclicked;
int transition_phase;
private:
void SetCurrentPosTime();
@ -149,8 +156,8 @@ private:
std::vector<int> BranchCurrX;
std::vector<int> BranchCurrY;
int CloudX, CloudPrevX, cloud_x;
int transition_phase;
int fireball_size;
int latest_drawn_item_under_mouse;
// GDI stuff
HBRUSH normal_brush;

View File

@ -293,7 +293,7 @@ void PIANO_ROLL::free()
}
void PIANO_ROLL::reset()
{
must_check_item_under_mouse = true;
must_redraw_list = must_check_item_under_mouse = true;
row_last_clicked = 0;
shift_held = ctrl_held = alt_held = false;
shift_timer = ctrl_timer = shift_count = ctrl_count = 0;
@ -428,31 +428,6 @@ void PIANO_ROLL::update()
if (GetAsyncKeyState(GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON) >= 0)
rbutton_drag_mode = false;
}
// scroll Piano Roll if user is dragging cursor outside
if (drag_mode != DRAG_MODE_NONE || rbutton_drag_mode)
{
POINT p;
if (GetCursorPos(&p))
{
ScreenToClient(hwndList, &p);
RECT wrect;
GetClientRect(hwndList, &wrect);
int scroll_dx = 0, scroll_dy = 0;
if (drag_mode != DRAG_MODE_MARKER) // in DRAG_MODE_MARKER user can't scroll Piano Roll horizontally
{
if (p.x < DRAG_SCROLLING_BORDER_SIZE)
scroll_dx = p.x - DRAG_SCROLLING_BORDER_SIZE;
else if (p.x > (wrect.right - wrect.left - DRAG_SCROLLING_BORDER_SIZE))
scroll_dx = p.x - (wrect.right - wrect.left - DRAG_SCROLLING_BORDER_SIZE);
}
if (p.y < (list_header_height + DRAG_SCROLLING_BORDER_SIZE))
scroll_dy = p.y - (list_header_height + DRAG_SCROLLING_BORDER_SIZE);
else if (p.y > (wrect.bottom - wrect.top - DRAG_SCROLLING_BORDER_SIZE))
scroll_dy = p.y - (wrect.bottom - wrect.top - DRAG_SCROLLING_BORDER_SIZE);
if (scroll_dx || scroll_dy)
ListView_Scroll(hwndList, scroll_dx, scroll_dy);
}
}
// perform drag
switch (drag_mode)
{
@ -527,6 +502,11 @@ void PIANO_ROLL::update()
info.pt.y = p.y + (len / total_len) * total_dy;
ListView_SubItemHitTest(hwndList, &info);
row_index = info.iItem;
if (row_index < 0)
row_index = ListView_GetTopIndex(hwndList) + (info.pt.y - list_row_top) / list_row_height;
// pad movie size if user tries to draw below Piano Roll limit
if (row_index >= currMovieData.getNumRecords())
currMovieData.insertEmpty(-1, row_index + 1 - currMovieData.getNumRecords());
column_index = info.iSubItem;
if (row_index >= 0 && column_index >= COLUMN_JOYPAD1_A && column_index <= COLUMN_JOYPAD4_R)
{
@ -561,10 +541,12 @@ void PIANO_ROLL::update()
}
case DRAG_MODE_SELECTION:
{
int new_drag_selection_ending_frame = row_under_mouse;
int new_drag_selection_ending_frame = real_row_under_mouse;
// if trying to select above Piano Roll, select from frame 0
if (new_drag_selection_ending_frame < 0 && real_row_under_mouse < 0)
if (new_drag_selection_ending_frame < 0)
new_drag_selection_ending_frame = 0;
else if (new_drag_selection_ending_frame >= currMovieData.getNumRecords())
new_drag_selection_ending_frame = currMovieData.getNumRecords() - 1;
if (new_drag_selection_ending_frame >= 0 && new_drag_selection_ending_frame != drag_selection_ending_frame)
{
// change selection shape
@ -620,6 +602,37 @@ void PIANO_ROLL::update()
hwndMarkerDragBox = 0;
}
}
// scroll Piano Roll if user is dragging cursor outside
if (drag_mode != DRAG_MODE_NONE || rbutton_drag_mode)
{
POINT p;
if (GetCursorPos(&p))
{
ScreenToClient(hwndList, &p);
RECT wrect;
GetClientRect(hwndList, &wrect);
int scroll_dx = 0, scroll_dy = 0;
if (drag_mode != DRAG_MODE_MARKER) // in DRAG_MODE_MARKER user can't scroll Piano Roll horizontally
{
if (p.x < DRAG_SCROLLING_BORDER_SIZE)
scroll_dx = p.x - DRAG_SCROLLING_BORDER_SIZE;
else if (p.x > (wrect.right - wrect.left - DRAG_SCROLLING_BORDER_SIZE))
scroll_dx = p.x - (wrect.right - wrect.left - DRAG_SCROLLING_BORDER_SIZE);
}
if (p.y < (list_header_height + DRAG_SCROLLING_BORDER_SIZE))
scroll_dy = p.y - (list_header_height + DRAG_SCROLLING_BORDER_SIZE);
else if (p.y > (wrect.bottom - wrect.top - DRAG_SCROLLING_BORDER_SIZE))
scroll_dy = p.y - (wrect.bottom - wrect.top - DRAG_SCROLLING_BORDER_SIZE);
if (scroll_dx || scroll_dy)
ListView_Scroll(hwndList, scroll_dx, scroll_dy);
}
}
// redraw list if needed
if (must_redraw_list)
{
InvalidateRect(hwndList, 0, false);
must_redraw_list = false;
}
// once per 40 milliseconds update colors alpha in the Header
if (clock() > next_header_update_time)
@ -720,9 +733,9 @@ error:
return true;
}
// ----------------------------------------------------------------------
void PIANO_ROLL::RedrawList(bool erase_bg)
void PIANO_ROLL::RedrawList()
{
InvalidateRect(hwndList, 0, erase_bg);
must_redraw_list = true;
must_check_item_under_mouse = true;
}
void PIANO_ROLL::RedrawRow(int index)

View File

@ -22,7 +22,7 @@
#define MARKER_DRAG_BOX_ALPHA 175
#define MARKER_DRAG_COUNTDOWN_MAX 14
#define MARKER_DRAG_ALPHA_PER_TICK 13
#define MARKER_DRAG_MAX_SPEED 70
#define MARKER_DRAG_MAX_SPEED 72
#define MARKER_DRAG_GRAVITY 2
#define DRAG_SCROLLING_BORDER_SIZE 10 // in pixels
@ -146,7 +146,7 @@ public:
void save(EMUFILE *os, bool really_save = true);
bool load(EMUFILE *is, bool really_load = true);
void RedrawList(bool erase_bg = true);
void RedrawList();
void RedrawRow(int index);
void RedrawHeader();
@ -221,6 +221,8 @@ private:
int num_columns;
int next_header_update_time;
bool must_redraw_list;
HMENU hrmenu;
WNDCLASSEX wincl;

View File

@ -384,6 +384,7 @@ void PLAYBACK::RedrawMarker()
void PLAYBACK::StartFromZero()
{
poweron(true);
FCEUMOV_ClearCommands(); // clear POWER SWITCH command caused by poweron()
currFrameCounter = 0;
if(currMovieData.getNumRecords() == 0)
currMovieData.insertEmpty(-1, 1);

View File

@ -133,7 +133,7 @@ void POPUP_DISPLAY::update()
if (clock() > next_update_time)
{
next_update_time = clock() + DISPLAY_UPDATE_TICK;
if (bookmarks.item_under_mouse >= 0 && bookmarks.item_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[bookmarks.item_under_mouse].not_empty)
if (bookmarks.IsSafeToShowBookmarksData() && bookmarks.item_under_mouse >= 0 && bookmarks.item_under_mouse < TOTAL_BOOKMARKS && bookmarks.bookmarks_array[bookmarks.item_under_mouse].not_empty)
{
if (taseditor_config.show_branch_screenshots && !hwndScrBmp)
{

View File

@ -760,14 +760,15 @@ void hand(X6502 *X, int type, unsigned int A)
}
int suppressAddPowerCommand=0; // hack... yeah, I know...
//int suppressAddPowerCommand=0; // hack... yeah, I know...
void PowerNES(void)
{
//void MapperInit();
//MapperInit();
if(!suppressAddPowerCommand)
//if(!suppressAddPowerCommand)
FCEUMOV_AddCommand(FCEUNPCMD_POWER);
if(!GameInfo) return;
FCEU_CheatResetRAM();

View File

@ -63,6 +63,8 @@ bool autoMovieBackup = false; //Toggle that determines if movies should be backe
bool freshMovie = false; //True when a movie loads, false when movie is altered. Used to determine if a movie has been altered since opening
bool movieFromPoweron = true;
static int _currCommand = 0;
// Function declarations------------------------
@ -794,7 +796,7 @@ void poweron(bool shouldDisableBatteryLoading)
disableBatteryLoading = 0;
}
void CreateCleanMovie()
void FCEUMOV_CreateCleanMovie()
{
currMovieData = MovieData();
currMovieData.palFlag = FCEUI_GetCurrentVidSystem(0,0)!=0;
@ -803,15 +805,16 @@ void CreateCleanMovie()
currMovieData.guid.newGuid();
currMovieData.fourscore = FCEUI_GetInputFourscore();
currMovieData.microphone = FCEUI_GetInputMicrophone();
//currMovieData.ports[0] = InputType[0];
//currMovieData.ports[1] = InputType[1];
//currMovieData.ports[2] = InputType[2];
currMovieData.ports[0] = joyports[0].type;
currMovieData.ports[1] = joyports[1].type;
currMovieData.ports[2] = portFC.type;
currMovieData.fds = isFDS;
currMovieData.PPUflag = (newppu != 0);
}
void FCEUMOV_ClearCommands()
{
_currCommand = 0;
}
bool FCEUMOV_FromPoweron()
{
@ -951,10 +954,9 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
currFrameCounter = 0;
LagCounterReset();
CreateCleanMovie();
FCEUMOV_CreateCleanMovie();
if(author != L"") currMovieData.comments.push_back(L"author " + author);
if(flags & MOVIE_FLAG_FROM_POWERON)
{
movieFromPoweron = true;
@ -966,6 +968,8 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
MovieData::dumpSavestateTo(&currMovieData.savestate,Z_BEST_COMPRESSION);
}
FCEUMOV_ClearCommands();
//we are going to go ahead and dump the header. from now on we will only be appending frames
currMovieData.dump(osRecordingMovie, false);
@ -976,7 +980,6 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
FCEU_DispMessage("Movie recording started.",0);
}
static int _currCommand = 0;
//the main interaction point between the emulator and the movie system.
//either dumps the current joystick state or loads one state from the movie

View File

@ -90,7 +90,8 @@ bool FCEUMOV_PostLoad();
bool FCEUMOV_FromPoweron();
void CreateCleanMovie();
void FCEUMOV_CreateCleanMovie();
void FCEUMOV_ClearCommands();
class MovieData;
class MovieRecord