* 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.
---------------------------------------------------------------------------
NOISE_VOL_FACTOR = 3.0;
NOISE_VOL_THRESHOLD = 0.35;
function track_changes()
if (taseditor.engaged()) then
@ -38,12 +38,12 @@ function track_changes()
-- Playback has moved
-- Get current value of indicator for current_frame
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 (last_frame == current_frame - 1) then
-- Looks like we advanced one frame from the last time
-- 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! ____/\____
-- 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));

View File

@ -310,7 +310,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(taseditor_config.show_lag_frames),
AC(taseditor_config.show_markers),
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.empty_marker_notes),
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);
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);
delete fp;
}

View File

@ -264,7 +264,7 @@ BEGIN
MENUITEM "Show &Lag Frames", ID_VIEW_SHOW_LAG_FRAMES
MENUITEM "Highlight &Markers", ID_VIEW_SHOW_MARKERS
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 SEPARATOR
MENUITEM "Follow &undo context", ID_VIEW_JUMPWHENMAKINGUNDO
@ -272,9 +272,9 @@ BEGIN
END
POPUP "&Config"
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 &autosave period", ID_CONFIG_SETAUTOSAVEPERIOD
MENUITEM "Set &Autosave period", ID_CONFIG_SETAUTOSAVEPERIOD
MENUITEM SEPARATOR
MENUITEM "Branches restore entire &Movie", ID_CONFIG_BRANCHESRESTOREFULLMOVIE
MENUITEM "Branches work only when &Recording", ID_CONFIG_BRANCHESWORKONLYWHENRECORDING
@ -285,13 +285,12 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "&Combine consecutive Recordings", ID_CONFIG_COMBINECONSECUTIVERECORDINGS
MENUITEM "Use 1&P keys for all single Recordings", ID_CONFIG_USE1PFORRECORDING
MENUITEM "Use &Input keys for ColumnSet", ID_CONFIG_USEINPUTKEYSFORCOLUMNSET
MENUITEM SEPARATOR
MENUITEM "Allow &keyboard controls in Listview", ID_CONFIG_KEYBOARDCONTROLSINLISTVIEW
MENUITEM "Use &Input keys for Column Set", ID_CONFIG_USEINPUTKEYSFORCOLUMNSET
MENUITEM "Allow &keyboard controls in Piano Roll", ID_CONFIG_KEYBOARDCONTROLSINLISTVIEW
MENUITEM "&Superimpose affects copy/paste", ID_CONFIG_SUPERIMPOSE_AFFECTS_PASTE
MENUITEM SEPARATOR
MENUITEM "Silent Autosave", ID_CONFIG_SILENTAUTOSAVE
MENUITEM "Mute &Turbo", ID_CONFIG_MUTETURBO
MENUITEM "Silent autosave", ID_CONFIG_SILENTAUTOSAVE
END
POPUP "&Help"
BEGIN
@ -1487,7 +1486,7 @@ BEGIN
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 " 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
END

View File

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

View File

@ -122,7 +122,7 @@ void POPUP_DISPLAY::update()
RedrawScreenshotBitmap();
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);
ChangeTooltipText();
@ -133,7 +133,7 @@ void POPUP_DISPLAY::update()
{
if (taseditor_config.show_branch_screenshots)
ChangeScreenshotBitmap();
if (taseditor_config.show_branch_tooltips)
if (taseditor_config.show_branch_descr)
ChangeTooltipText();
screenshot_currently_shown = bookmarks.item_under_mouse;
}

View File

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

View File

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

View File

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

View File

@ -129,6 +129,7 @@ public:
void FollowUndo();
void FollowSelection();
void FollowPauseframe();
void FollowMarker(int marker_id);
void SetHeaderColumnLight(int column, int level);
@ -153,6 +154,8 @@ public:
HBRUSH bg_brush;
private:
void CenterListAt(int frame);
std::vector<uint8> header_colors;
int num_columns;
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_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_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_FOLLOWMARKERNOTECONTEXT, taseditor_config.follow_note_context?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
ClearTaseditorInput();
if (taseditor_config.follow_note_context)
list.FollowPlayback();
list.FollowMarker(playback.shown_marker);
break;
}
case EN_KILLFOCUS:
@ -790,7 +790,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
// disable FCEUX keyboard
ClearTaseditorInput();
if (taseditor_config.follow_note_context)
list.FollowSelection();
list.FollowMarker(selection.shown_marker);
break;
}
case EN_KILLFOCUS:
@ -977,7 +977,7 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
break;
case ID_VIEW_SHOWBRANCHTOOLTIPS:
//switch "Show Branch Screenshots" flag
taseditor_config.show_branch_tooltips ^= 1;
taseditor_config.show_branch_descr ^= 1;
taseditor_window.UpdateCheckedItems();
break;
case ID_VIEW_ENABLEHOTCHANGES:

View File

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