* Taseditor: Delete, Insert, InsertNum, Clone and PasteInsert also shift Laglog

* added "Force Grayscale" checkbox to Palette config
* deleted old SubWCWeb.exe since SubWCRev.exe is used instead
This commit is contained in:
ansstuff 2012-08-29 17:46:58 +00:00
parent f62eb3e427
commit a2fb69118b
25 changed files with 179 additions and 184 deletions

View File

@ -1,3 +1,4 @@
29-Aug-2012 - AnS - added "Force Grayscale" checkbox to Palette config
26-Aug-2012 - AnS - Taseditor: History Log highlights items related to current item
25-Aug-2012 - AnS - Taseditor: fixed AdjustLag feature and changed fm3 version to v2
22-Aug-2012 - AnS - added "Clear" button to Message Log

View File

@ -191,8 +191,7 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int
palettetranslate=(uint32 *)FCEU_dmalloc(65536*4);
else if(Bpp>=3)
palettetranslate=(uint32 *)FCEU_dmalloc(65536*4);
}
else
} else
{
if(Bpp==2)
palettetranslate=(uint32*)FCEU_dmalloc(65536*4);

View File

@ -166,6 +166,7 @@ static CFGSTRUCT fceuconfig[] = {
AC(gNoBGFillColor),
AC(ntsccol),AC(ntsctint),AC(ntschue),
AC(force_grayscale),
NAC("palyo",pal_emulation),
NAC("genie",genie),

View File

@ -104,6 +104,7 @@ extern int srendlinep;
extern int erendlinep;
extern int ntsccol, ntsctint, ntschue;
extern bool force_grayscale;
//mbg merge 7/17/06 did these have to be unsigned?
//static int srendline, erendline;

View File

@ -67,9 +67,7 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case WM_INITDIALOG:
if(ntsccol)
{
CheckDlgButton(hwndDlg, CHECK_PALETTE_ENABLED, BST_CHECKED);
}
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETRANGE, 1, MAKELONG(0, 128));
@ -79,6 +77,9 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SendDlgItemMessage(hwndDlg, CTL_TINT_TRACKBAR, TBM_SETPOS, 1, ntsctint);
SendDlgItemMessage(hwndDlg, CTL_HUE_TRACKBAR, TBM_SETPOS, 1, ntschue);
if(force_grayscale)
CheckDlgButton(hwndDlg, CHECK_PALETTE_GRAYSCALE, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, BTN_PALETTE_RESET), (eoptions & EO_CPALETTE) ? 1 : 0);
CenterWindowOnScreen(hwndDlg);
@ -105,6 +106,11 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case CHECK_PALETTE_GRAYSCALE:
force_grayscale ^= 1;
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
break;
case BTN_PALETTE_LOAD:
if(LoadPaletteFile())
{

View File

@ -850,14 +850,15 @@ FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,94,56,14
GROUPBOX "NES Palette",302,10,8,102,81,WS_GROUP
DEFPUSHBUTTON "&Load Palette...",BTN_PALETTE_LOAD,18,32,58,14
DEFPUSHBUTTON "&Reset to Default Palette",BTN_PALETTE_RESET,18,55,85,14
DEFPUSHBUTTON "&Load Palette...",BTN_PALETTE_LOAD,18,26,58,14
DEFPUSHBUTTON "&Reset to Default Palette",BTN_PALETTE_RESET,18,46,85,14
CONTROL "Enabled",CHECK_PALETTE_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,22,87,12
CONTROL "Tint",CTL_TINT_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,121,44,91,11
GROUPBOX "NTSC Color Emulation",101,115,8,103,81,WS_GROUP
CONTROL "Hue",CTL_HUE_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,121,69,91,11
CTEXT "Hue",64395,124,59,85,8
CTEXT "Tint",65463,123,34,85,8
CONTROL "Force Grayscale",CHECK_PALETTE_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,68,87,12
END
POWERPADDIALOG DIALOG 30, 123, 131, 119

View File

@ -49,6 +49,8 @@
#define IDC_ROMPATCHER_OFFSET 102
#define IDC_NTVIEW_SCANLINE 102
#define IDC_ASSEMBLER_PATCH_DISASM 102
#define CHECK_PALETTE_ENABLED2 102
#define CHECK_PALETTE_GRAYSCALE 102
#define BTN_CDLOGGER_RESET 103
#define LBL_PPUVIEW_TILE1 103
#define IDC_CHEAT_VAL 103
@ -1125,8 +1127,8 @@
#define ID_CONFIG_AUTO 40566
#define ID_CONFIG_ADJUSTLAG 40567
#define ID_CONFIG_PATTERNSKIPSLAG 40568
#define CLEAR_LOG 40569
#define CLOSE_LOG 40570
#define CLEAR_LOG 40569
#define CLOSE_LOG 40570
#define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426

View File

@ -173,13 +173,13 @@ void EDITOR::InputToggle(int start, int end, int joy, int button, int consecutiv
// clear range
for (int i = start; i <= end; ++i)
currMovieData.records[i].clearBit(joy, button);
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_UNSET, start, end, NULL, consecutive_tag));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_UNSET, start, end, 0, NULL, consecutive_tag));
} else
{
// set range
for (int i = start; i <= end; ++i)
currMovieData.records[i].setBit(joy, button);
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_SET, start, end, NULL, consecutive_tag));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_SET, start, end, 0, NULL, consecutive_tag));
}
}
void EDITOR::InputSetPattern(int start, int end, int joy, int button, int consecutive_tag)
@ -217,7 +217,7 @@ void EDITOR::InputSetPattern(int start, int end, int joy, int button, int consec
pattern_offset -= autofire_patterns[current_pattern].size();
}
if (changes_made)
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PATTERN, start, end, autofire_patterns_names[current_pattern].c_str(), consecutive_tag));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PATTERN, start, end, 0, autofire_patterns_names[current_pattern].c_str(), consecutive_tag));
}
// following functions use current Selection to determine range of frames
@ -377,7 +377,7 @@ bool EDITOR::InputColumnSetPattern(int joy, int button)
if (pattern_offset >= (int)autofire_patterns[current_pattern].size())
pattern_offset -= autofire_patterns[current_pattern].size();
}
int first_changes = history.RegisterChanges(MODTYPE_PATTERN, *current_selection_begin, *current_selection->rbegin(), autofire_patterns_names[current_pattern].c_str());
int first_changes = history.RegisterChanges(MODTYPE_PATTERN, *current_selection_begin, *current_selection->rbegin(), 0, autofire_patterns_names[current_pattern].c_str());
if (first_changes >= 0)
{
greenzone.InvalidateAndCheck(first_changes);
@ -435,50 +435,5 @@ void EDITOR::RemoveMarkers()
}
}
}
// these two functions don't restore Playback cursor, they only invalidate Greenzone
void EDITOR::AdjustUp(int at)
{
if (at < 0)
return;
bool markers_changed = false;
// delete one frame
currMovieData.records.erase(currMovieData.records.begin() + at);
if (taseditor_config.bind_markers)
{
if (markers_manager.EraseMarker(at))
markers_changed = true;
}
// check if user deleted all frames
if (!currMovieData.getNumRecords())
playback.StartFromZero();
// reduce Piano Roll
piano_roll.UpdateItemCount();
// check and register changes
history.RegisterChanges(MODTYPE_ADJUST_LAG, at, -1, NULL, -1);
greenzone.Invalidate(at);
if (markers_changed)
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
void EDITOR::AdjustDown(int at)
{
if (at < 0)
return;
bool markers_changed = false;
// insert blank frame
currMovieData.insertEmpty(at, 1);
if (taseditor_config.bind_markers)
{
if (markers_manager.insertEmpty(at, 1))
markers_changed = true;
}
// check and register changes
history.RegisterChanges(MODTYPE_ADJUST_LAG, at, -1, NULL, 1);
greenzone.Invalidate(at);
if (markers_changed)
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
// ----------------------------------------------------------------------------------------------

View File

@ -19,9 +19,6 @@ public:
void SetMarkers();
void RemoveMarkers();
void AdjustUp(int at);
void AdjustDown(int at);
std::vector<std::string> autofire_patterns_names;
std::vector<std::vector<uint8>> autofire_patterns;

View File

@ -29,7 +29,7 @@ extern TASEDITOR_PROJECT project;
extern PLAYBACK playback;
extern BOOKMARKS bookmarks;
extern PIANO_ROLL piano_roll;
extern EDITOR editor;
extern SPLICER splicer;
extern char lagFlag;
@ -91,8 +91,7 @@ void GREENZONE::CollectCurrentState()
if (old_lagFlag && !lagFlag)
{
// there's no more lag on previous frame - shift Input up
laglog.EraseLagFrame(currFrameCounter - 1);
editor.AdjustUp(currFrameCounter - 1);
splicer.AdjustUp(currFrameCounter - 1);
// since AdjustUp didn't restore Playback cursor, we must rewind here
bool emu_was_paused = (FCEUI_EmulationPaused() != 0);
int saved_pause_frame = playback.GetPauseFrame();
@ -104,8 +103,7 @@ void GREENZONE::CollectCurrentState()
} else if (!old_lagFlag && lagFlag)
{
// there's new lag on previous frame - shift Input down
laglog.InsertLagFrame(currFrameCounter - 1);
editor.AdjustDown(currFrameCounter - 1);
splicer.AdjustDown(currFrameCounter - 1);
// since AdjustDown didn't restore Playback cursor, we must rewind here
bool emu_was_paused = (FCEUI_EmulationPaused() != 0);
int saved_pause_frame = playback.GetPauseFrame();

View File

@ -480,7 +480,7 @@ void HISTORY::AddItemToHistory(SNAPSHOT &snap, int cur_branch, BOOKMARK &bookm)
// Here goes the set of functions that register project changes and log them into History log
// returns frame of first actual change
int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comment, int consecutive_tag)
int HISTORY::RegisterChanges(int mod_type, int start, int end, int size, const char* comment, int consecutive_tag, SelectionFrames* frameset)
{
// create new shanshot
SNAPSHOT snap;
@ -491,6 +491,7 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
if (first_changes >= 0)
{
// differences found
char framenum[11];
// fill description:
snap.mod_type = mod_type;
strcat(snap.description, modCaptions[snap.mod_type]);
@ -507,9 +508,11 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
break;
}
case MODTYPE_INSERT:
case MODTYPE_DELETE:
case MODTYPE_INSERTNUM:
case MODTYPE_PASTEINSERT:
case MODTYPE_PASTE:
case MODTYPE_CLONE:
case MODTYPE_DELETE:
case MODTYPE_PATTERN:
case MODTYPE_ADJUST_LAG:
{
@ -523,7 +526,7 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
{
// special operation: AdjustLag
snap.start_frame = snap.end_frame = start;
snap.consecutive_tag = consecutive_tag; // -1 for Adjust Up, +1 for Adjust Down
snap.consecutive_tag = size; // -1 for Adjust Up, +1 for Adjust Down
// combine Adjustment with previous snapshot if needed
bool combine = false;
if (snapshots[real_pos].mod_type == MODTYPE_ADJUST_LAG)
@ -541,15 +544,14 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
// set hotchanges
if (taseditor_config.enable_hot_changes)
{
if (consecutive_tag < 0)
if (size < 0)
// it was Adjust Up
snap.inputlog.inheritHotChanges_DeleteNum(&snapshots[real_pos].inputlog, start, 1, !combine);
else
// it was Adjust Down
snap.inputlog.inheritHotChanges_InsertNum(&snapshots[real_pos].inputlog, start, 1, !combine);
}
// add "consecutive_tag" to description
char framenum[11];
// add "consecutive size" to description
strcat(snap.description, " [");
if (snap.consecutive_tag > 0)
strcat(snap.description, "+");
@ -586,7 +588,30 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
{
// normal operations
snap.start_frame = start;
snap.end_frame = end;
if (mod_type == MODTYPE_INSERTNUM)
{
snap.end_frame = start + size - 1;
_itoa(size, framenum, 10);
strcat(snap.description, framenum);
} else
{
snap.end_frame = end;
}
// for lag-affecting operations only
if (first_changes > start && end == -1 && taseditor_config.adjust_input_due_to_lag)
{
// check if LagLogs of these snapshots differ before the "first_changes" frame
for (int i = start; i < first_changes; ++i)
{
if (snap.laglog.GetLagInfoAtFrame(i) != snapshots[real_pos].laglog.GetLagInfoAtFrame(i))
{
// Greenzone should be invalidated from the frame
first_changes = i;
break;
}
}
}
snap.consecutive_tag = consecutive_tag;
if (consecutive_tag && taseditor_config.combine_consecutive && snapshots[real_pos].mod_type == snap.mod_type && snapshots[real_pos].consecutive_tag == snap.consecutive_tag)
{
@ -598,7 +623,6 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
if (snap.end_frame < snapshots[real_pos].end_frame)
snap.end_frame = snapshots[real_pos].end_frame;
// add upper and lower frame to description
char framenum[11];
strcat(snap.description, " ");
_itoa(snap.start_frame, framenum, 10);
strcat(snap.description, framenum);
@ -629,7 +653,6 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
{
// don't combine
// add upper and lower frame to description
char framenum[11];
strcat(snap.description, " ");
_itoa(snap.start_frame, framenum, 10);
strcat(snap.description, framenum);
@ -658,6 +681,9 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
case MODTYPE_CLONE:
snap.inputlog.inheritHotChanges_InsertSelection(&snapshots[real_pos].inputlog);
break;
case MODTYPE_INSERTNUM:
snap.inputlog.inheritHotChanges_InsertNum(&snapshots[real_pos].inputlog, start, size, true);
break;
case MODTYPE_SET:
case MODTYPE_UNSET:
case MODTYPE_CLEAR:
@ -667,6 +693,9 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
snap.inputlog.inheritHotChanges(&snapshots[real_pos].inputlog);
snap.inputlog.fillHotChanges(snapshots[real_pos].inputlog, first_changes, end);
break;
case MODTYPE_PASTEINSERT:
snap.inputlog.inheritHotChanges_PasteInsert(&snapshots[real_pos].inputlog, frameset);
break;
case MODTYPE_TRUNCATE:
snap.inputlog.copyHotChanges(&snapshots[real_pos].inputlog);
// do not add new hotchanges and do not fade old hotchanges, because there was nothing added
@ -681,72 +710,6 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
}
return first_changes;
}
int HISTORY::RegisterInsertNum(int start, int frames)
{
// create new shanshot
SNAPSHOT snap;
snap.init(currMovieData, taseditor_config.enable_hot_changes);
// check if there are Input differences from latest snapshot
int real_pos = (history_start_pos + history_cursor_pos) % history_size;
int first_changes = snap.inputlog.findFirstChange(snapshots[real_pos].inputlog, start);
if (first_changes >= 0)
{
// differences found
// fill description:
snap.mod_type = MODTYPE_INSERTNUM;
strcat(snap.description, modCaptions[snap.mod_type]);
snap.keyframe = start;
snap.start_frame = start;
snap.end_frame = start + frames - 1;
char framenum[11];
// add number of inserted frames to description
_itoa(frames, framenum, 10);
strcat(snap.description, framenum);
// add upper frame to description
strcat(snap.description, " ");
_itoa(snap.start_frame, framenum, 10);
strcat(snap.description, framenum);
// set hotchanges
if (taseditor_config.enable_hot_changes)
snap.inputlog.inheritHotChanges_InsertNum(&snapshots[real_pos].inputlog, start, frames, true);
AddItemToHistory(snap);
branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
}
return first_changes;
}
int HISTORY::RegisterPasteInsert(int start, SelectionFrames& inserted_set)
{
// create new shanshot
SNAPSHOT snap;
snap.init(currMovieData, taseditor_config.enable_hot_changes);
// check if there are Input differences from latest snapshot
int real_pos = (history_start_pos + history_cursor_pos) % history_size;
int first_changes = snap.inputlog.findFirstChange(snapshots[real_pos].inputlog, start);
if (first_changes >= 0)
{
// differences found
// fill description:
snap.mod_type = MODTYPE_PASTEINSERT;
strcat(snap.description, modCaptions[snap.mod_type]);
// for PasteInsert user prefers to see frame of attempted change (Selection cursor position), not frame of actual differences
snap.keyframe = start;
snap.start_frame = start;
snap.end_frame = -1;
// add upper frame to description
char framenum[11];
strcat(snap.description, " ");
_itoa(snap.start_frame, framenum, 10);
strcat(snap.description, framenum);
// set hotchanges
if (taseditor_config.enable_hot_changes)
snap.inputlog.inheritHotChanges_PasteInsert(&snapshots[real_pos].inputlog, inserted_set);
AddItemToHistory(snap);
branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
}
return first_changes;
}
void HISTORY::RegisterMarkersChange(int mod_type, int start, int end, const char* comment)
{
// create new shanshot

View File

@ -106,11 +106,11 @@ public:
void undo();
void redo();
int RegisterChanges(int mod_type, int start = 0, int end =-1, const char* comment = NULL, int consecutive_tag = 0);
int RegisterInsertNum(int start, int frames);
int RegisterPasteInsert(int start, SelectionFrames& inserted_set);
int RegisterChanges(int mod_type, int start = 0, int end =-1, int size = 0, const char* comment = NULL, int consecutive_tag = 0, SelectionFrames* frameset = NULL);
void RegisterMarkersChange(int mod_type, int start = 0, int end =-1, const char* comment = 0);
void RegisterBookmarkSet(int slot, BOOKMARK& backup_copy, int old_current_branch);
int RegisterBranching(int slot, bool markers_changed);
void RegisterRecording(int frame_of_change);
int RegisterImport(MovieData& md, char* filename);

View File

@ -664,16 +664,19 @@ void INPUTLOG::inheritHotChanges_InsertNum(INPUTLOG* source_of_hotchanges, int s
// fill the gap with max_hot lines on frames from "start" to "start+frames"
memset(&hot_changes[bytes * start], 0xFF, bytes * frames);
}
void INPUTLOG::inheritHotChanges_PasteInsert(INPUTLOG* source_of_hotchanges, SelectionFrames& inserted_set)
void INPUTLOG::inheritHotChanges_PasteInsert(INPUTLOG* source_of_hotchanges, SelectionFrames* inserted_set)
{
// copy hot changes from source InputLog and insert filled lines for inserted frames (which are represented by inserted_set)
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0;
int this_size = hot_changes.size();
SelectionFrames::iterator it(inserted_set->begin());
SelectionFrames::iterator inserted_set_end(inserted_set->end());
if (source_of_hotchanges && source_of_hotchanges->has_hot_changes && source_of_hotchanges->input_type == input_type)
{
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0, source_pos = 0;
int this_size = hot_changes.size(), source_size = source_of_hotchanges->hot_changes.size();
SelectionFrames::iterator it(inserted_set.begin());
SelectionFrames::iterator inserted_set_end(inserted_set.end());
int source_pos = 0;
int source_size = source_of_hotchanges->hot_changes.size();
while (pos < this_size)
{
if (it != inserted_set_end && frame == *it)
@ -695,11 +698,6 @@ void INPUTLOG::inheritHotChanges_PasteInsert(INPUTLOG* source_of_hotchanges, Sel
} else
{
// no old data, just fill selected lines
int bytes = joysticks_per_frame[input_type] * HOTCHANGE_BYTES_PER_JOY;
int frame = 0, pos = 0;
int this_size = hot_changes.size();
SelectionFrames::iterator it(inserted_set.begin());
SelectionFrames::iterator inserted_set_end(inserted_set.end());
while (pos < this_size)
{
if (it != inserted_set_end && frame == *it)

View File

@ -42,7 +42,7 @@ public:
void inheritHotChanges_InsertSelection(INPUTLOG* source_of_hotchanges);
void inheritHotChanges_DeleteNum(INPUTLOG* source_of_hotchanges, int start, int frames, bool fade_old);
void inheritHotChanges_InsertNum(INPUTLOG* source_of_hotchanges, int start, int frames, bool fade_old);
void inheritHotChanges_PasteInsert(INPUTLOG* source_of_hotchanges, SelectionFrames& inserted_set);
void inheritHotChanges_PasteInsert(INPUTLOG* source_of_hotchanges, SelectionFrames* inserted_set);
void fillHotChanges(INPUTLOG& their_log, int start = 0, int end = -1);
void SetMaxHotChange_Bits(int frame, int joypad, uint8 joy_bits);

View File

@ -125,13 +125,19 @@ void LAGLOG::SetLagInfo(int frame, bool lagFlag)
already_compressed = false;
}
void LAGLOG::EraseLagFrame(int frame)
void LAGLOG::EraseFrame(int frame)
{
lag_log.erase(lag_log.begin() + (currFrameCounter - 1));
if (lag_log.size() > frame)
lag_log.erase(lag_log.begin() + (currFrameCounter - 1));
}
void LAGLOG::InsertLagFrame(int frame)
void LAGLOG::InsertFrame(int frame, bool lagFlag, int frames)
{
lag_log.insert(lag_log.begin() + frame, 1);
if (lag_log.size() > frame)
// insert
lag_log.insert(lag_log.begin() + frame, frames, (lagFlag) ? 1 : 0);
else
// append
lag_log.resize(frame + 1, (lagFlag) ? 1 : 0);
}
// getters

View File

@ -15,8 +15,8 @@ public:
bool skipLoad(EMUFILE *is);
void SetLagInfo(int frame, bool lagFlag);
void EraseLagFrame(int frame);
void InsertLagFrame(int frame);
void EraseFrame(int frame);
void InsertFrame(int frame, bool lagFlag, int frames = 1);
int GetSize();
bool GetLagInfoAtFrame(int frame);

View File

@ -663,9 +663,9 @@ void PIANO_ROLL::update()
if (changes_made)
{
if (drag_mode == DRAG_MODE_SET)
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_SET, min_row_index, max_row_index, NULL, drawing_start_time));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_SET, min_row_index, max_row_index, 0, NULL, drawing_start_time));
else
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_UNSET, min_row_index, max_row_index, NULL, drawing_start_time));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_UNSET, min_row_index, max_row_index, 0, NULL, drawing_start_time));
}
}
drawing_last_x = drawing_current_x;

View File

@ -62,13 +62,15 @@ void SNAPSHOT::compress_data()
{
if (!inputlog.Get_already_compressed())
inputlog.compress_data();
if (!laglog.Get_already_compressed())
laglog.compress_data();
if (!markers.Get_already_compressed())
markers.compress_data();
}
bool SNAPSHOT::Get_already_compressed()
{
// only consider this snapshot fully compressed when all of InputLog, LagLog and Markers are compressed
return (inputlog.Get_already_compressed() && markers.Get_already_compressed());
return (inputlog.Get_already_compressed() && laglog.Get_already_compressed() && markers.Get_already_compressed());
}
void SNAPSHOT::save(EMUFILE *os)

View File

@ -110,6 +110,7 @@ void SPLICER::CloneFrames()
if (!frames) return;
selection.ClearSelection(); // Selection will be moved down, so that same frames are selected
int i;
bool markers_changed = false;
currMovieData.records.reserve(currMovieData.getNumRecords() + frames);
// insert frames before each selection, but consecutive Selection lines are accounted as single region
@ -125,6 +126,7 @@ void SPLICER::CloneFrames()
{
// end of current region
currMovieData.cloneRegion(*it, frames);
greenzone.laglog.InsertFrame(*it, false, frames);
if (taseditor_config.bind_markers)
{
// Markers are not cloned
@ -173,6 +175,7 @@ void SPLICER::InsertFrames()
{
// end of current region
currMovieData.insertEmpty(*it, frames);
greenzone.laglog.InsertFrame(*it, false, frames);
if (taseditor_config.bind_markers)
{
if (markers_manager.insertEmpty(*it, frames))
@ -218,6 +221,7 @@ void SPLICER::InsertNumFrames()
index = currFrameCounter;
}
currMovieData.insertEmpty(index, frames);
greenzone.laglog.InsertFrame(index, false, frames);
if (taseditor_config.bind_markers)
{
if (markers_manager.insertEmpty(index, frames))
@ -233,7 +237,7 @@ void SPLICER::InsertNumFrames()
selection.SetRowSelection((*it) + frames);
}
// check and register changes
int first_changes = history.RegisterInsertNum(index, frames);
int first_changes = history.RegisterChanges(MODTYPE_INSERTNUM, index, -1, frames);
if (first_changes >= 0)
{
greenzone.InvalidateAndCheck(first_changes);
@ -261,6 +265,7 @@ void SPLICER::DeleteFrames()
for(SelectionFrames::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++)
{
currMovieData.records.erase(currMovieData.records.begin() + *it);
greenzone.laglog.EraseFrame(*it);
if (taseditor_config.bind_markers)
{
if (markers_manager.EraseMarker(*it))
@ -329,7 +334,7 @@ void SPLICER::Truncate()
}
}
piano_roll.UpdateItemCount();
int result = history.RegisterChanges(MODTYPE_TRUNCATE, frame+1);
int result = history.RegisterChanges(MODTYPE_TRUNCATE, frame + 1);
if (result >= 0)
{
greenzone.InvalidateAndCheck(result);
@ -433,10 +438,9 @@ bool SPLICER::Paste()
if (!OpenClipboard(taseditor_window.hwndTasEditor)) return false;
SelectionFrames::iterator current_selection_begin(current_selection->begin());
int num_joypads = joysticks_per_frame[GetInputType(currMovieData)];
bool result = false;
int pos = *current_selection_begin;
int pos = *(current_selection->begin());
HANDLE hGlobal = GetClipboardData(CF_TEXT);
if (hGlobal)
{
@ -459,7 +463,7 @@ bool SPLICER::Paste()
uint8 new_buttons = 0;
std::vector<uint8> flash_joy(num_joypads);
char* frame;
--pos;
pos--;
while (pGlobal++ && *pGlobal!='\0')
{
// Detect skipped frames in paste
@ -472,7 +476,7 @@ bool SPLICER::Paste()
if (*frame=='|') ++frame;
} else
{
++pos;
pos++;
}
if (taseditor_config.superimpose == SUPERIMPOSE_UNCHECKED)
@ -500,7 +504,7 @@ bool SPLICER::Paste()
flash_joy[joy] |= new_buttons; // highlight buttons that were added
currMovieData.records[pos].joysticks[joy] = new_buttons;
}
++joy;
joy++;
new_buttons = 0;
break;
default:
@ -514,7 +518,7 @@ bool SPLICER::Paste()
}
break;
}
++frame;
frame++;
}
// before going to next frame, flush buttons to movie data
if (taseditor_config.superimpose == SUPERIMPOSE_CHECKED || (taseditor_config.superimpose == SUPERIMPOSE_INDETERMINATE && new_buttons == 0))
@ -530,7 +534,7 @@ bool SPLICER::Paste()
pGlobal = strchr(pGlobal, '\n');
}
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PASTE, *current_selection_begin));
greenzone.InvalidateAndCheck(history.RegisterChanges(MODTYPE_PASTE, *(current_selection->begin()), pos));
// flash Piano Roll header columns that were changed during paste
for (int joy = 0; joy < num_joypads; ++joy)
{
@ -583,7 +587,7 @@ bool SPLICER::PasteInsert()
char* frame;
int joy=0;
std::vector<uint8> flash_joy(num_joypads);
--pos;
pos--;
while (pGlobal++ && *pGlobal!='\0')
{
// Detect skipped frames in paste
@ -601,11 +605,12 @@ bool SPLICER::PasteInsert()
if (*frame=='|') ++frame;
} else
{
++pos;
pos++;
}
// insert new frame
currMovieData.insertEmpty(pos, 1);
greenzone.laglog.InsertFrame(pos, false, 1);
if (taseditor_config.bind_markers)
{
if (markers_manager.insertEmpty(pos, 1))
@ -620,7 +625,7 @@ bool SPLICER::PasteInsert()
switch (*frame)
{
case '|': // Joystick mark
++joy;
joy++;
break;
default:
for (int bit = 0; bit < NUM_JOYPAD_BUTTONS; ++bit)
@ -634,13 +639,13 @@ bool SPLICER::PasteInsert()
}
break;
}
++frame;
frame++;
}
pGlobal = strchr(pGlobal, '\n');
}
markers_manager.update();
int first_changes = history.RegisterPasteInsert(*current_selection_begin, inserted_set);
int first_changes = history.RegisterChanges(MODTYPE_PASTEINSERT, *current_selection_begin, -1, 0, NULL, 0, &inserted_set);
if (first_changes >= 0)
{
greenzone.InvalidateAndCheck(first_changes);
@ -670,6 +675,51 @@ bool SPLICER::PasteInsert()
CloseClipboard();
return result;
}
// these two functions don't restore Playback cursor, they only invalidate Greenzone
void SPLICER::AdjustUp(int at)
{
if (at < 0)
return;
bool markers_changed = false;
// delete one frame of lag
currMovieData.records.erase(currMovieData.records.begin() + at);
greenzone.laglog.EraseFrame(at);
if (taseditor_config.bind_markers)
{
if (markers_manager.EraseMarker(at))
markers_changed = true;
}
// check if user deleted all frames
if (!currMovieData.getNumRecords())
playback.StartFromZero();
// reduce Piano Roll
piano_roll.UpdateItemCount();
// check and register changes
history.RegisterChanges(MODTYPE_ADJUST_LAG, at, -1, -1);
greenzone.Invalidate(at);
if (markers_changed)
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
void SPLICER::AdjustDown(int at)
{
if (at < 0)
return;
bool markers_changed = false;
// insert blank frame with lag
currMovieData.insertEmpty(at, 1);
greenzone.laglog.InsertFrame(at, true, 1);
if (taseditor_config.bind_markers)
{
if (markers_manager.insertEmpty(at, 1))
markers_changed = true;
}
// check and register changes
history.RegisterChanges(MODTYPE_ADJUST_LAG, at, -1, 1);
greenzone.Invalidate(at);
if (markers_changed)
selection.must_find_current_marker = playback.must_find_current_marker = true;
}
// ----------------------------------------------------------------------------------------------
// retrieves some information from clipboard to clipboard_selection
void SPLICER::CheckClipboard()

View File

@ -19,6 +19,9 @@ public:
bool Paste();
bool PasteInsert();
void AdjustUp(int at);
void AdjustDown(int at);
void RedrawTextClipboard();
SelectionFrames& GetClipboardSelection();

View File

@ -113,9 +113,19 @@ int RestoreDD(int w)
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b)
{
color_palette[index].peRed=r;
color_palette[index].peGreen=g;
color_palette[index].peBlue=b;
if (force_grayscale)
{
// convert the palette entry to grayscale
int gray = ((float)r * 0.299 + (float)g * 0.587 + (float)b * 0.114);
color_palette[index].peRed = gray;
color_palette[index].peGreen = gray;
color_palette[index].peBlue = gray;
} else
{
color_palette[index].peRed = r;
color_palette[index].peGreen = g;
color_palette[index].peBlue = b;
}
PaletteChanged=1;
}

View File

@ -46,6 +46,8 @@ static int ntsccol=0;
static int ntsctint=46+10;
static int ntschue=72;
bool force_grayscale = false;
/* These are dynamically filled/generated palettes: */
pal palettei[64]; // Custom palette for an individual game.
pal palettec[64]; // Custom "global" palette.

View File

@ -761,7 +761,7 @@ void ShowFPS(void)
boop[boopcount] = FCEUD_GetTime();
sprintf(fpsmsg, "%7.1f",(double)booplimit / ((double)da / FCEUD_GetTimeFreq()));
DrawTextTrans(ClipSidesOffset + XBuf + ((256 - 2 * ClipSidesOffset) - 7 * 8) + (FSettings.FirstSLine+4)*256, 256, (uint8*)fpsmsg, 4);
DrawTextTrans(ClipSidesOffset + XBuf + ((256 - 2 * ClipSidesOffset) - 7 * 8) + (FSettings.FirstSLine+4)*256, 256, (uint8*)fpsmsg, 7);
// It's not averaging FPS over exactly 1 second, but it's close enough.
boopcount = (boopcount + 1) % booplimit;
}

View File

@ -1,4 +1,4 @@
SubWCRev.exe ..\.. "defaultconfig\svnrev_template.h" "userconfig\svnrev.h"
SubWCRev.exe .. "defaultconfig\svnrev_template.h" "userconfig\svnrev.h"
IF NOT EXIST defaultconfig\makedownload exit 0
SubWCRev.exe ..\.. "..\..\web\download.html" "userconfig\download.html"
SubWCRev.exe .. "..\..\web\download.html" "userconfig\download.html"
exit 0

Binary file not shown.