Taseditor: minor refactoring

This commit is contained in:
ansstuff 2012-06-18 15:13:27 +00:00
parent f3debc89dc
commit c11cdffadd
5 changed files with 15 additions and 10 deletions

View File

@ -1493,7 +1493,7 @@ END
IDD_TASEDITOR_SAVECOMPACT DIALOGEX 0, 0, 122, 134 IDD_TASEDITOR_SAVECOMPACT DIALOGEX 0, 0, 122, 134
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog" CAPTION "Save Compact"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Save",IDOK,7,114,50,14 DEFPUSHBUTTON "Save",IDOK,7,114,50,14

View File

@ -600,7 +600,11 @@ void Import()
char drv[512], dir[512], name[1024], ext[512]; char drv[512], dir[512], name[1024], ext[512];
splitpath(nameo, drv, dir, name, ext); splitpath(nameo, drv, dir, name, ext);
strcat(name, ext); strcat(name, ext);
history.RegisterImport(md, name); int result = history.RegisterImport(md, name);
if (result >= 0)
greenzone.InvalidateAndCheck(result);
else
MessageBox(taseditor_window.hwndTasEditor, "Imported movie has the same input.\nNo changes were made.", "TAS Editor", MB_OK);
} else } else
{ {
FCEUD_PrintError("Error loading movie data!"); FCEUD_PrintError("Error loading movie data!");

View File

@ -14,6 +14,7 @@ Greenzone - Access zone
* also stores the frame-by-frame log of lag appearance * also stores the frame-by-frame log of lag appearance
* saves and loads the data from a project file. On error: truncates Greenzone to last successfully read savestate * saves and loads the data from a project file. On error: truncates Greenzone to last successfully read savestate
* regularly checks if there's a savestate of current emulation state, if there's no such savestate in array then creates one and updates lag info for previous frame * regularly checks if there's a savestate of current emulation state, if there's no such savestate in array then creates one and updates lag info for previous frame
* implements the working of "Auto-adjust Input due to lag"
* regularly runs gradual cleaning of the savestates array (for memory saving), deleting oldest savestates * regularly runs gradual cleaning of the savestates array (for memory saving), deleting oldest savestates
* on demand: (when movie input was changed) truncates the size of Greenzone, deleting savestates that became irrelevant because of new input. After truncating it may also move Playback cursor (which must always reside within Greenzone) and may launch Playback seeking * on demand: (when movie input was changed) truncates the size of Greenzone, deleting savestates that became irrelevant because of new input. After truncating it may also move Playback cursor (which must always reside within Greenzone) and may launch Playback seeking
* stores resources: save id, properties of gradual cleaning, timing of cleaning * stores resources: save id, properties of gradual cleaning, timing of cleaning
@ -435,7 +436,6 @@ void GREENZONE::InvalidateAndCheck(int after)
{ {
if (after >= 0) if (after >= 0)
{ {
project.SetProjectChanged();
if (greenZoneCount > after+1) if (greenZoneCount > after+1)
{ {
greenZoneCount = after+1; greenZoneCount = after+1;
@ -466,7 +466,6 @@ void GREENZONE::Invalidate(int after)
{ {
if (after >= 0) if (after >= 0)
{ {
project.SetProjectChanged();
if (greenZoneCount > after+1) if (greenZoneCount > after+1)
{ {
greenZoneCount = after+1; greenZoneCount = after+1;

View File

@ -660,6 +660,7 @@ int HISTORY::RegisterChanges(int mod_type, int start, int end, const char* comme
} }
} }
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
} }
return first_changes; return first_changes;
} }
@ -693,6 +694,7 @@ int HISTORY::RegisterInsertNum(int start, int frames)
snap.inheritHotChanges_InsertNum(&snapshots[real_pos], start, frames, true); snap.inheritHotChanges_InsertNum(&snapshots[real_pos], start, frames, true);
AddItemToHistory(snap); AddItemToHistory(snap);
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
} }
return first_changes; return first_changes;
} }
@ -724,6 +726,7 @@ int HISTORY::RegisterPasteInsert(int start, SelectionFrames& inserted_set)
snap.inheritHotChanges_PasteInsert(&snapshots[real_pos], inserted_set); snap.inheritHotChanges_PasteInsert(&snapshots[real_pos], inserted_set);
AddItemToHistory(snap); AddItemToHistory(snap);
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
} }
return first_changes; return first_changes;
} }
@ -899,8 +902,9 @@ void HISTORY::RegisterRecording(int frame_of_change)
AddItemToHistory(snap); AddItemToHistory(snap);
} }
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
} }
void HISTORY::RegisterImport(MovieData& md, char* filename) int HISTORY::RegisterImport(MovieData& md, char* filename)
{ {
// create new snapshot // create new snapshot
SNAPSHOT snap; SNAPSHOT snap;
@ -930,11 +934,8 @@ void HISTORY::RegisterImport(MovieData& md, char* filename)
piano_roll.UpdateItemCount(); piano_roll.UpdateItemCount();
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged(); project.SetProjectChanged();
greenzone.InvalidateAndCheck(first_changes);
} else
{
MessageBox(taseditor_window.hwndTasEditor, "Imported movie has the same input.\nNo changes were made.", "TAS Editor", MB_OK);
} }
return first_changes;
} }
int HISTORY::RegisterLuaChanges(const char* name, int start, bool InsertionDeletion_was_made) int HISTORY::RegisterLuaChanges(const char* name, int start, bool InsertionDeletion_was_made)
{ {
@ -999,6 +1000,7 @@ int HISTORY::RegisterLuaChanges(const char* name, int start, bool InsertionDelet
} }
AddItemToHistory(snap); AddItemToHistory(snap);
branches.ChangesMadeSinceBranch(); branches.ChangesMadeSinceBranch();
project.SetProjectChanged();
} }
return first_changes; return first_changes;
} }

View File

@ -112,7 +112,7 @@ public:
void RegisterBookmarkSet(int slot, BOOKMARK& backup_copy, int old_current_branch); void RegisterBookmarkSet(int slot, BOOKMARK& backup_copy, int old_current_branch);
int RegisterBranching(int slot, bool markers_changed); int RegisterBranching(int slot, bool markers_changed);
void RegisterRecording(int frame_of_change); void RegisterRecording(int frame_of_change);
void RegisterImport(MovieData& md, char* filename); int RegisterImport(MovieData& md, char* filename);
int RegisterLuaChanges(const char* name, int start, bool InsertionDeletion_was_made); int RegisterLuaChanges(const char* name, int start, bool InsertionDeletion_was_made);
int GetCategoryOfOperation(int mod_type); int GetCategoryOfOperation(int mod_type);