* Taseditor: when clicking text fields, Piano Roll scrolls to corresponding Marker, not to cursor

* Replay dialog speedup, now movie is not loaded into memory when checking md5
This commit is contained in:
ansstuff 2012-02-13 15:49:02 +00:00
parent 80e27fe681
commit 7ea17f7f35
12 changed files with 64 additions and 73 deletions

View File

@ -29,7 +29,7 @@
-- so that Markers will be created using new set of rules. -- so that Markers will be created using new set of rules.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
NOISE_VOL_FACTOR = 3.0; NOISE_VOL_THRESHOLD = 0.35;
function track_changes() function track_changes()
if (taseditor.engaged()) then if (taseditor.engaged()) then
@ -38,12 +38,12 @@ function track_changes()
-- Playback has moved -- Playback has moved
-- Get current value of indicator for current_frame -- Get current value of indicator for current_frame
snd = sound.get(); snd = sound.get();
indicator = NOISE_VOL_FACTOR * snd.rp2a03.noise.volume; indicator = snd.rp2a03.noise.volume;
-- If Playback moved 1 frame forward, this was probably Frame Advance -- If Playback moved 1 frame forward, this was probably Frame Advance
if (last_frame == current_frame - 1) then if (last_frame == current_frame - 1) then
-- Looks like we advanced one frame from the last time -- Looks like we advanced one frame from the last time
-- Decide whether to set Marker -- Decide whether to set Marker
if (indicator >= 1 and last_frame_indicator_value == 0) then if (indicator > NOISE_VOL_THRESHOLD and last_frame_indicator_value == 0) then
-- this was a peak in volume! ____/\____ -- this was a peak in volume! ____/\____
-- Set Marker and show frequency of noise+triangle in its Note -- Set Marker and show frequency of noise+triangle in its Note
SetSoundMarker(current_frame - 1, "Sound: " .. (snd.rp2a03.noise.regs.frequency + snd.rp2a03.triangle.regs.frequency)); SetSoundMarker(current_frame - 1, "Sound: " .. (snd.rp2a03.noise.regs.frequency + snd.rp2a03.triangle.regs.frequency));

View File

@ -310,7 +310,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(taseditor_config.show_lag_frames), AC(taseditor_config.show_lag_frames),
AC(taseditor_config.show_markers), AC(taseditor_config.show_markers),
AC(taseditor_config.show_branch_screenshots), AC(taseditor_config.show_branch_screenshots),
AC(taseditor_config.show_branch_tooltips), AC(taseditor_config.show_branch_descr),
AC(taseditor_config.bind_markers), AC(taseditor_config.bind_markers),
AC(taseditor_config.empty_marker_notes), AC(taseditor_config.empty_marker_notes),
AC(taseditor_config.combine_consecutive_rec), AC(taseditor_config.combine_consecutive_rec),

View File

@ -576,7 +576,7 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
FCEUFILE* fp = FCEU_fopen(filename,0,"rb",0); FCEUFILE* fp = FCEU_fopen(filename,0,"rb",0);
if(fp) if(fp)
{ {
fp->stream = fp->stream->memwrap(); //fp->stream = fp->stream->memwrap(); - no need to load whole movie to memory! We only need to read movie header!
HandleScan(hwndDlg, fp, items); HandleScan(hwndDlg, fp, items);
delete fp; delete fp;
} }

View File

@ -264,7 +264,7 @@ BEGIN
MENUITEM "Show &Lag Frames", ID_VIEW_SHOW_LAG_FRAMES MENUITEM "Show &Lag Frames", ID_VIEW_SHOW_LAG_FRAMES
MENUITEM "Highlight &Markers", ID_VIEW_SHOW_MARKERS MENUITEM "Highlight &Markers", ID_VIEW_SHOW_MARKERS
MENUITEM "Display Branch &Screenshots", ID_VIEW_SHOWBRANCHSCREENSHOTS MENUITEM "Display Branch &Screenshots", ID_VIEW_SHOWBRANCHSCREENSHOTS
MENUITEM "Display Branch &Tooltips", ID_VIEW_SHOWBRANCHTOOLTIPS MENUITEM "Display Branch &Descriptions", ID_VIEW_SHOWBRANCHTOOLTIPS
MENUITEM "Enable Hot &Changes", ID_VIEW_ENABLEHOTCHANGES MENUITEM "Enable Hot &Changes", ID_VIEW_ENABLEHOTCHANGES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Follow &undo context", ID_VIEW_JUMPWHENMAKINGUNDO MENUITEM "Follow &undo context", ID_VIEW_JUMPWHENMAKINGUNDO
@ -272,9 +272,9 @@ BEGIN
END END
POPUP "&Config" POPUP "&Config"
BEGIN BEGIN
MENUITEM "Set &greenzone capacity", ID_CONFIG_SETGREENZONECAPACITY MENUITEM "Set &Greenzone capacity", ID_CONFIG_SETGREENZONECAPACITY
MENUITEM "Set max &undo levels", ID_CONFIG_SETMAXUNDOLEVELS MENUITEM "Set max &undo levels", ID_CONFIG_SETMAXUNDOLEVELS
MENUITEM "Set &autosave period", ID_CONFIG_SETAUTOSAVEPERIOD MENUITEM "Set &Autosave period", ID_CONFIG_SETAUTOSAVEPERIOD
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Branches restore entire &Movie", ID_CONFIG_BRANCHESRESTOREFULLMOVIE MENUITEM "Branches restore entire &Movie", ID_CONFIG_BRANCHESRESTOREFULLMOVIE
MENUITEM "Branches work only when &Recording", ID_CONFIG_BRANCHESWORKONLYWHENRECORDING MENUITEM "Branches work only when &Recording", ID_CONFIG_BRANCHESWORKONLYWHENRECORDING
@ -286,12 +286,11 @@ BEGIN
MENUITEM "&Combine consecutive Recordings", ID_CONFIG_COMBINECONSECUTIVERECORDINGS MENUITEM "&Combine consecutive Recordings", ID_CONFIG_COMBINECONSECUTIVERECORDINGS
MENUITEM "Use 1&P keys for all single Recordings", ID_CONFIG_USE1PFORRECORDING MENUITEM "Use 1&P keys for all single Recordings", ID_CONFIG_USE1PFORRECORDING
MENUITEM "Use &Input keys for Column Set", ID_CONFIG_USEINPUTKEYSFORCOLUMNSET MENUITEM "Use &Input keys for Column Set", ID_CONFIG_USEINPUTKEYSFORCOLUMNSET
MENUITEM SEPARATOR MENUITEM "Allow &keyboard controls in Piano Roll", ID_CONFIG_KEYBOARDCONTROLSINLISTVIEW
MENUITEM "Allow &keyboard controls in Listview", ID_CONFIG_KEYBOARDCONTROLSINLISTVIEW
MENUITEM "&Superimpose affects copy/paste", ID_CONFIG_SUPERIMPOSE_AFFECTS_PASTE MENUITEM "&Superimpose affects copy/paste", ID_CONFIG_SUPERIMPOSE_AFFECTS_PASTE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Silent Autosave", ID_CONFIG_SILENTAUTOSAVE
MENUITEM "Mute &Turbo", ID_CONFIG_MUTETURBO MENUITEM "Mute &Turbo", ID_CONFIG_MUTETURBO
MENUITEM "Silent autosave", ID_CONFIG_SILENTAUTOSAVE
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
@ -1487,7 +1486,7 @@ BEGIN
CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,37,67,10 CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,37,67,10
CONTROL " Greenzone",IDC_CHECK_GREENZONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,52,67,10 CONTROL " Greenzone",IDC_CHECK_GREENZONE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,52,67,10
CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,67,67,10 CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,67,67,10
CONTROL " List data",IDC_CHECK_LIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,82,67,10 CONTROL " Piano Roll",IDC_CHECK_LIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,82,67,10
CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,97,67,10 CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,97,67,10
END END

View File

@ -254,11 +254,16 @@ bool SaveProjectAs()
char nameo[2048]; char nameo[2048];
if (project.GetProjectName().empty()) if (project.GetProjectName().empty())
{
// suggest ROM name for this project // suggest ROM name for this project
strcpy(nameo, mass_replace(GetRomName(), "|", ".").c_str()); //convert | to . for archive filenames strcpy(nameo, mass_replace(GetRomName(), "|", ".").c_str()); //convert | to . for archive filenames
else // add .fm3 extension
strncat(nameo, ".fm3", 2047);
} else
{
// suggest current name // suggest current name
strncpy(nameo, project.GetProjectName().c_str(), 2047); strncpy(nameo, project.GetProjectName().c_str(), 2047);
}
ofn.lpstrFile = nameo; ofn.lpstrFile = nameo;
ofn.lpstrDefExt = "fm3"; ofn.lpstrDefExt = "fm3";

View File

@ -122,7 +122,7 @@ void POPUP_DISPLAY::update()
RedrawScreenshotBitmap(); RedrawScreenshotBitmap();
ShowWindow(hwndScrBmp, SW_SHOWNA); ShowWindow(hwndScrBmp, SW_SHOWNA);
} }
if (taseditor_config.show_branch_tooltips && !hwndMarkerNoteTooltip) if (taseditor_config.show_branch_descr && !hwndMarkerNoteTooltip)
{ {
hwndMarkerNoteTooltip = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT, szClassName2, szClassName2, WS_POPUP, taseditor_config.wndx + tooltip_x, taseditor_config.wndy + tooltip_y, MARKER_NOTE_TOOLTIP_WIDTH, MARKER_NOTE_TOOLTIP_HEIGHT, taseditor_window.hwndTasEditor, NULL, fceu_hInstance, NULL); hwndMarkerNoteTooltip = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT, szClassName2, szClassName2, WS_POPUP, taseditor_config.wndx + tooltip_x, taseditor_config.wndy + tooltip_y, MARKER_NOTE_TOOLTIP_WIDTH, MARKER_NOTE_TOOLTIP_HEIGHT, taseditor_window.hwndTasEditor, NULL, fceu_hInstance, NULL);
ChangeTooltipText(); ChangeTooltipText();
@ -133,7 +133,7 @@ void POPUP_DISPLAY::update()
{ {
if (taseditor_config.show_branch_screenshots) if (taseditor_config.show_branch_screenshots)
ChangeScreenshotBitmap(); ChangeScreenshotBitmap();
if (taseditor_config.show_branch_tooltips) if (taseditor_config.show_branch_descr)
ChangeTooltipText(); ChangeTooltipText();
screenshot_currently_shown = bookmarks.item_under_mouse; screenshot_currently_shown = bookmarks.item_under_mouse;
} }

View File

@ -16,7 +16,7 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
show_lag_frames = true; show_lag_frames = true;
show_markers = true; show_markers = true;
show_branch_screenshots = true; show_branch_screenshots = true;
show_branch_tooltips = true; show_branch_descr = true;
enable_hot_changes = true; enable_hot_changes = true;
jump_to_undo = true; jump_to_undo = true;
follow_note_context = true; follow_note_context = true;
@ -24,7 +24,7 @@ TASEDITOR_CONFIG::TASEDITOR_CONFIG()
empty_marker_notes = true; empty_marker_notes = true;
combine_consecutive_rec = true; combine_consecutive_rec = true;
use_1p_rec = true; use_1p_rec = true;
columnset_by_keys = true; columnset_by_keys = false;
keyboard_for_listview = true; keyboard_for_listview = true;
superimpose = 0; // SUPERIMPOSE_UNCHECKED superimpose = 0; // SUPERIMPOSE_UNCHECKED
superimpose_affects_paste = true; superimpose_affects_paste = true;

View File

@ -32,7 +32,7 @@ public:
bool show_lag_frames; bool show_lag_frames;
bool show_markers; bool show_markers;
bool show_branch_screenshots; bool show_branch_screenshots;
bool show_branch_tooltips; bool show_branch_descr;
bool enable_hot_changes; bool enable_hot_changes;
bool jump_to_undo; bool jump_to_undo;
bool follow_note_context; bool follow_note_context;

View File

@ -346,21 +346,25 @@ bool TASEDITOR_LIST::CheckItemVisible(int frame)
return false; return false;
} }
void TASEDITOR_LIST::FollowPlayback() void TASEDITOR_LIST::CenterListAt(int frame)
{ {
// center list at jump_frame
int list_items = ListView_GetCountPerPage(hwndList); int list_items = ListView_GetCountPerPage(hwndList);
int lower_border = (list_items - 1) / 2; int lower_border = (list_items - 1) / 2;
int upper_border = (list_items - 1) - lower_border; int upper_border = (list_items - 1) - lower_border;
int index = currFrameCounter + lower_border; int index = frame + lower_border;
if (index >= currMovieData.getNumRecords()) if (index >= currMovieData.getNumRecords())
index = currMovieData.getNumRecords()-1; index = currMovieData.getNumRecords()-1;
ListView_EnsureVisible(hwndList, index, false); ListView_EnsureVisible(hwndList, index, false);
index = currFrameCounter - upper_border; index = frame - upper_border;
if (index < 0) if (index < 0)
index = 0; index = 0;
ListView_EnsureVisible(hwndList, index, false); ListView_EnsureVisible(hwndList, index, false);
} }
void TASEDITOR_LIST::FollowPlayback()
{
CenterListAt(currFrameCounter);
}
void TASEDITOR_LIST::FollowPlaybackIfNeeded() void TASEDITOR_LIST::FollowPlaybackIfNeeded()
{ {
if (taseditor_config.follow_playback) ListView_EnsureVisible(hwndList,currFrameCounter,FALSE); if (taseditor_config.follow_playback) ListView_EnsureVisible(hwndList,currFrameCounter,FALSE);
@ -371,20 +375,7 @@ void TASEDITOR_LIST::FollowUndo()
if (taseditor_config.jump_to_undo && jump_frame >= 0) if (taseditor_config.jump_to_undo && jump_frame >= 0)
{ {
if (!CheckItemVisible(jump_frame)) if (!CheckItemVisible(jump_frame))
{ CenterListAt(jump_frame);
// center list at jump_frame
int list_items = ListView_GetCountPerPage(hwndList);
int lower_border = (list_items - 1) / 2;
int upper_border = (list_items - 1) - lower_border;
int index = jump_frame + lower_border;
if (index >= currMovieData.getNumRecords())
index = currMovieData.getNumRecords()-1;
ListView_EnsureVisible(hwndList, index, false);
index = jump_frame - upper_border;
if (index < 0)
index = 0;
ListView_EnsureVisible(hwndList, index, false);
}
} }
} }
void TASEDITOR_LIST::FollowSelection() void TASEDITOR_LIST::FollowSelection()
@ -413,36 +404,25 @@ void TASEDITOR_LIST::FollowSelection()
} else } else
{ {
// selected region is too big to fit in screen // selected region is too big to fit in screen
// just center at selection_start // oh well, just center at selection_start
int lower_border = (list_items - 1) / 2; CenterListAt(selection_start);
int upper_border = (list_items - 1) - lower_border;
int index = selection_start + lower_border;
if (index >= currMovieData.getNumRecords())
index = currMovieData.getNumRecords()-1;
ListView_EnsureVisible(hwndList, index, false);
index = selection_start - upper_border;
if (index < 0)
index = 0;
ListView_EnsureVisible(hwndList, index, false);
} }
} }
void TASEDITOR_LIST::FollowPauseframe() void TASEDITOR_LIST::FollowPauseframe()
{ {
int jump_frame = playback.pause_frame; if (playback.pause_frame > 0)
if (jump_frame >= 0) CenterListAt(playback.pause_frame - 1);
}
void TASEDITOR_LIST::FollowMarker(int marker_id)
{ {
// center list at jump_frame if (marker_id > 0)
int list_items = ListView_GetCountPerPage(hwndList); {
int lower_border = (list_items - 1) / 2; int frame = markers_manager.GetMarkerFrame(marker_id);
int upper_border = (list_items - 1) - lower_border; if (frame >= 0)
int index = jump_frame + lower_border; CenterListAt(frame);
if (index >= currMovieData.getNumRecords()) } else
index = currMovieData.getNumRecords()-1; {
ListView_EnsureVisible(hwndList, index, false); ListView_EnsureVisible(hwndList, 0, false);
index = jump_frame - upper_border;
if (index < 0)
index = 0;
ListView_EnsureVisible(hwndList, index, false);
} }
} }

View File

@ -129,6 +129,7 @@ public:
void FollowUndo(); void FollowUndo();
void FollowSelection(); void FollowSelection();
void FollowPauseframe(); void FollowPauseframe();
void FollowMarker(int marker_id);
void SetHeaderColumnLight(int column, int level); void SetHeaderColumnLight(int column, int level);
@ -153,6 +154,8 @@ public:
HBRUSH bg_brush; HBRUSH bg_brush;
private: private:
void CenterListAt(int frame);
std::vector<uint8> header_colors; std::vector<uint8> header_colors;
int num_columns; int num_columns;
int next_header_update_time; int next_header_update_time;

View File

@ -436,7 +436,7 @@ void TASEDITOR_WINDOW::UpdateCheckedItems()
CheckMenuItem(hmenu, ID_VIEW_SHOW_LAG_FRAMES, taseditor_config.show_lag_frames?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_SHOW_LAG_FRAMES, taseditor_config.show_lag_frames?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_SHOW_MARKERS, taseditor_config.show_markers?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_SHOW_MARKERS, taseditor_config.show_markers?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_SHOWBRANCHSCREENSHOTS, taseditor_config.show_branch_screenshots?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_SHOWBRANCHSCREENSHOTS, taseditor_config.show_branch_screenshots?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_SHOWBRANCHTOOLTIPS, taseditor_config.show_branch_tooltips?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_SHOWBRANCHTOOLTIPS, taseditor_config.show_branch_descr?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_JUMPWHENMAKINGUNDO, taseditor_config.jump_to_undo?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_JUMPWHENMAKINGUNDO, taseditor_config.jump_to_undo?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_FOLLOWMARKERNOTECONTEXT, taseditor_config.follow_note_context?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_FOLLOWMARKERNOTECONTEXT, taseditor_config.follow_note_context?MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hmenu, ID_VIEW_ENABLEHOTCHANGES, taseditor_config.enable_hot_changes?MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hmenu, ID_VIEW_ENABLEHOTCHANGES, taseditor_config.enable_hot_changes?MF_CHECKED : MF_UNCHECKED);
@ -758,7 +758,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
// disable FCEUX keyboard // disable FCEUX keyboard
ClearTaseditorInput(); ClearTaseditorInput();
if (taseditor_config.follow_note_context) if (taseditor_config.follow_note_context)
list.FollowPlayback(); list.FollowMarker(playback.shown_marker);
break; break;
} }
case EN_KILLFOCUS: case EN_KILLFOCUS:
@ -790,7 +790,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
// disable FCEUX keyboard // disable FCEUX keyboard
ClearTaseditorInput(); ClearTaseditorInput();
if (taseditor_config.follow_note_context) if (taseditor_config.follow_note_context)
list.FollowSelection(); list.FollowMarker(selection.shown_marker);
break; break;
} }
case EN_KILLFOCUS: case EN_KILLFOCUS:
@ -977,7 +977,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
break; break;
case ID_VIEW_SHOWBRANCHTOOLTIPS: case ID_VIEW_SHOWBRANCHTOOLTIPS:
//switch "Show Branch Screenshots" flag //switch "Show Branch Screenshots" flag
taseditor_config.show_branch_tooltips ^= 1; taseditor_config.show_branch_descr ^= 1;
taseditor_window.UpdateCheckedItems(); taseditor_window.UpdateCheckedItems();
break; break;
case ID_VIEW_ENABLEHOTCHANGES: case ID_VIEW_ENABLEHOTCHANGES:

View File

@ -601,15 +601,19 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
// Non-TASEditor projects consume until EOF // Non-TASEditor projects consume until EOF
movieData.loadFrameCount = -1; movieData.loadFrameCount = -1;
std::ios::pos_type curr = fp->ftell();
if (!stopAfterHeader)
{
// first, look for an fcm signature // first, look for an fcm signature
char fcmbuf[3]; char fcmbuf[3];
std::ios::pos_type curr = fp->ftell();
fp->fread(fcmbuf,3); fp->fread(fcmbuf,3);
fp->fseek(curr,SEEK_SET); fp->fseek(curr,SEEK_SET);
if(!strncmp(fcmbuf,"FCM",3)) { if(!strncmp(fcmbuf,"FCM",3)) {
FCEU_PrintError("FCM File format is no longer supported. Please use Tools > Convert FCM"); FCEU_PrintError("FCM File format is no longer supported. Please use Tools > Convert FCM");
return false; return false;
} }
}
//movie must start with "version 3" //movie must start with "version 3"
char buf[9]; char buf[9];