diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index 8296519a..e6c59ba2 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -277,6 +277,8 @@ TasEditorWindow::~TasEditorWindow(void) ::branches = NULL; ::splicer = NULL; + clearProjectList(); + fceuWrapperUnLock(); // Save Horizontal Panel State diff --git a/src/drivers/Qt/TasEditor/bookmark.cpp b/src/drivers/Qt/TasEditor/bookmark.cpp index 5cceca14..c6a99257 100644 --- a/src/drivers/Qt/TasEditor/bookmark.cpp +++ b/src/drivers/Qt/TasEditor/bookmark.cpp @@ -30,6 +30,7 @@ extern uint8 *XBackBuf; BOOKMARK::BOOKMARK() { notEmpty = false; + flashType = flashPhase = floatingPhase = 0; } void BOOKMARK::init() diff --git a/src/drivers/Qt/TasEditor/bookmarks.cpp b/src/drivers/Qt/TasEditor/bookmarks.cpp index 722c64c0..efad29b2 100644 --- a/src/drivers/Qt/TasEditor/bookmarks.cpp +++ b/src/drivers/Qt/TasEditor/bookmarks.cpp @@ -49,6 +49,8 @@ BOOKMARKS::BOOKMARKS(QWidget *parent) viewWidth = 256; viewHeight = 256; + editMode = EDIT_MODE_BOOKMARKS; + imageItem = 0; imageTimer = new QTimer(this); imageTimer->setSingleShot(true); @@ -86,6 +88,7 @@ void BOOKMARKS::init() reset(); selectedSlot = DEFAULT_SLOT; imageItem = 0; + editMode = EDIT_MODE_BOOKMARKS; redrawBookmarksSectionCaption(); } @@ -820,6 +823,7 @@ bool BOOKMARKS::event(QEvent *event) { if (event->type() == QEvent::ToolTip) { + fceuCriticalSection emuLock; int item, row_under_mouse, item_valid, column; QHelpEvent *helpEvent = static_cast(event); diff --git a/src/drivers/Qt/TasEditor/branches.cpp b/src/drivers/Qt/TasEditor/branches.cpp index 5829665a..93b37081 100644 --- a/src/drivers/Qt/TasEditor/branches.cpp +++ b/src/drivers/Qt/TasEditor/branches.cpp @@ -43,6 +43,21 @@ BRANCHES::BRANCHES(QWidget *parent) { std::string fontString; + mustRedrawBranchesBitmap = false; + mustRecalculateBranchesTree = false; + branchRightclicked = 0; + currentBranch = 0; + changesSinceCurrentBranch = false; + memset( cloudTimestamp, 0, sizeof(cloudTimestamp) ); + memset( currentPosTimestamp, 0, sizeof(currentPosTimestamp) ); + transitionPhase = 0; + currentAnimationFrame = 0; + nextAnimationTime = 0; + playbackCursorX = playbackCursorY = 0; + cornersCursorX = cornersCursorY = 0; + fireballSize = 0; + lastItemUnderMouse = -1; + imageItem = 0; imageTimer = new QTimer(this); imageTimer->setSingleShot(true); @@ -127,7 +142,6 @@ void BRANCHES::init() free(); // subclass BranchesBitmap - //hwndBranchesBitmap_oldWndProc = (WNDPROC)SetWindowLongPtr(bookmarks.hwndBranchesBitmap, GWLP_WNDPROC, (LONG_PTR)BranchesBitmapWndProc); // init arrays branchX.resize(TOTAL_BOOKMARKS+1); @@ -497,6 +511,7 @@ void BRANCHES::mouseDoubleClickEvent(QMouseEvent * event) void BRANCHES::mousePressEvent(QMouseEvent * event) { + fceuCriticalSection emuLock; int item = findItemUnderMouse( event->pos().x(), event->pos().y() ); bookmarks->itemUnderMouse = item; @@ -546,6 +561,7 @@ void BRANCHES::mousePressEvent(QMouseEvent * event) void BRANCHES::mouseReleaseEvent(QMouseEvent * event) { + fceuCriticalSection emuLock; int item = findItemUnderMouse( event->pos().x(), event->pos().y() ); bookmarks->itemUnderMouse = item; @@ -573,6 +589,7 @@ void BRANCHES::showImage(void) void BRANCHES::mouseMoveEvent(QMouseEvent * event) { + fceuCriticalSection emuLock; int item, item_valid; item = findItemUnderMouse( event->pos().x(), event->pos().y() ); @@ -608,6 +625,7 @@ bool BRANCHES::event(QEvent *event) { if (event->type() == QEvent::ToolTip) { + fceuCriticalSection emuLock; int item, item_valid; QHelpEvent *helpEvent = static_cast(event); @@ -671,7 +689,8 @@ void BRANCHES::paintEvent(QPaintEvent *event) { parentX = branchCurrentX[t-1]; parentY = branchCurrentY[t-1]; - } else + } + else { parentX = cloudCurrentX; parentY = BRANCHES_CLOUD_Y; @@ -679,7 +698,7 @@ void BRANCHES::paintEvent(QPaintEvent *event) for (int i = children[t].size() - 1; i >= 0; i--) { childID = children[t][i]; - if (childID < TOTAL_BOOKMARKS) + if ( (childID >= 0) && (childID < TOTAL_BOOKMARKS) ) { //MoveToEx(hBitmapDC, parentX, parentY, 0); //LineTo(hBitmapDC, branchCurrentX[childID], branchCurrentY[childID]); diff --git a/src/drivers/Qt/TasEditor/greenzone.cpp b/src/drivers/Qt/TasEditor/greenzone.cpp index bfac1fff..6954d155 100644 --- a/src/drivers/Qt/TasEditor/greenzone.cpp +++ b/src/drivers/Qt/TasEditor/greenzone.cpp @@ -28,19 +28,10 @@ Greenzone - Access zone #include "Qt/TasEditor/taseditor_project.h" #include "Qt/TasEditor/TasEditorWindow.h" -//extern TASEDITOR_CONFIG taseditorConfig; -//extern TASEDITOR_PROJECT project; -//extern PLAYBACK playback; -//extern HISTORY history; -//extern BOOKMARKS bookmarks; -//extern MARKERS_MANAGER markersManager; -//extern PIANO_ROLL pianoRoll; -//extern SELECTION selection; - extern char lagFlag; -char greenzone_save_id[GREENZONE_ID_LEN] = "GREENZONE"; -char greenzone_skipsave_id[GREENZONE_ID_LEN] = "GREENZONX"; +static char greenzone_save_id[GREENZONE_ID_LEN] = "GREENZONE"; +static char greenzone_skipsave_id[GREENZONE_ID_LEN] = "GREENZONX"; GREENZONE::GREENZONE() { @@ -224,13 +215,15 @@ void GREENZONE::ungreenzoneSelectedFrames() RowsSelection* current_selection = selection->getCopyOfCurrentRowsSelection(); if (current_selection->size() == 0) return; bool changed = false; - int size = savestates.size(); - int start_index = *current_selection->begin(); - int end_index = *current_selection->rbegin(); + //int size = savestates.size(); + //int start_index = *current_selection->begin(); + //int end_index = *current_selection->rbegin(); RowsSelection::reverse_iterator current_selection_rend = current_selection->rend(); // degreenzone frames, going backwards for (RowsSelection::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++) + { changed = changed | clearSavestateAndFreeMemory(*it); + } if (changed) { //pianoRoll.redraw(); diff --git a/src/drivers/Qt/TasEditor/inputlog.cpp b/src/drivers/Qt/TasEditor/inputlog.cpp index 93a8fc27..1f1851b5 100644 --- a/src/drivers/Qt/TasEditor/inputlog.cpp +++ b/src/drivers/Qt/TasEditor/inputlog.cpp @@ -30,6 +30,10 @@ int joysticksPerFrame[INPUT_TYPES_TOTAL] = {1, 2, 4}; INPUTLOG::INPUTLOG() { + size = 0; + inputType = 0; + hasHotChanges = 0; + alreadyCompressed = false; } void INPUTLOG::init(MovieData& md, bool hotchanges, int force_input_type) diff --git a/src/drivers/Qt/TasEditor/selection.cpp b/src/drivers/Qt/TasEditor/selection.cpp index 5035a65e..1ea6c004 100644 --- a/src/drivers/Qt/TasEditor/selection.cpp +++ b/src/drivers/Qt/TasEditor/selection.cpp @@ -28,40 +28,30 @@ Selection - Manager of selections #include "Qt/TasEditor/taseditor_project.h" #include "Qt/TasEditor/TasEditorWindow.h" -//extern TASEDITOR_CONFIG taseditorConfig; -//extern TASEDITOR_WINDOW taseditorWindow; -//extern MARKERS_MANAGER markersManager; -//extern PIANO_ROLL pianoRoll; -//extern SPLICER splicer; -//extern EDITOR editor; -//extern GREENZONE greenzone; - extern int joysticksPerFrame[INPUT_TYPES_TOTAL]; -//LRESULT APIENTRY LowerMarkerEditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -//WNDPROC selectionMarkerEdit_oldWndproc; - // resources -char selection_save_id[SELECTION_ID_LEN] = "SELECTION"; -char selection_skipsave_id[SELECTION_ID_LEN] = "SELECTIOX"; -char lowerMarkerText[] = "Marker "; +static char selection_save_id[SELECTION_ID_LEN] = "SELECTION"; +static char selection_skipsave_id[SELECTION_ID_LEN] = "SELECTIOX"; +static char lowerMarkerText[] = "Marker "; SELECTION::SELECTION() { + trackSelectionChanges = true; + lastSelectionBeginning = -1; + + previousMarkerButtonState = previousMarkerButtonOldState = false; + nextMarkerButtonState = nextMarkerButtonOldState = false; + buttonHoldTimer = 0; + + historyCursorPos = -1; + historyStartPos = 0; + historySize = 1; + historyTotalItems = 0; } void SELECTION::init() { - //hwndPreviousMarkerButton = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_PREV_MARKER); - //hwndNextMarkerButton = GetDlgItem(taseditorWindow.hwndTASEditor, TASEDITOR_NEXT_MARKER); - //hwndSelectionMarkerNumber = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_SELECTION_MARKER); - //SendMessage(hwndSelectionMarkerNumber, WM_SETFONT, (WPARAM)pianoRoll.hMarkersFont, 0); - //hwndSelectionMarkerEditField = GetDlgItem(taseditorWindow.hwndTASEditor, IDC_SELECTION_MARKER_EDIT); - //SendMessage(hwndSelectionMarkerEditField, EM_SETLIMITTEXT, MAX_NOTE_LEN - 1, 0); - //SendMessage(hwndSelectionMarkerEditField, WM_SETFONT, (WPARAM)pianoRoll.hMarkersEditFont, 0); - // subclass the edit control - //selectionMarkerEdit_oldWndproc = (WNDPROC)SetWindowLongPtr(hwndSelectionMarkerEditField, GWLP_WNDPROC, (LONG_PTR)LowerMarkerEditWndProc); - reset(); } void SELECTION::free() @@ -396,7 +386,7 @@ bool SELECTION::skipLoadSelection(EMUFILE *is) void SELECTION::noteThatItemRangeChanged(int startItem, int endItem, int newValue ) { bool ON = newValue; - bool OFF = !newValue; + //bool OFF = !newValue; if (ON) { diff --git a/src/drivers/Qt/TasEditor/snapshot.cpp b/src/drivers/Qt/TasEditor/snapshot.cpp index b4a21729..c633a593 100644 --- a/src/drivers/Qt/TasEditor/snapshot.cpp +++ b/src/drivers/Qt/TasEditor/snapshot.cpp @@ -20,14 +20,17 @@ Snapshot - Snapshot of all edited data #include "Qt/TasEditor/taseditor_project.h" #include "Qt/TasEditor/TasEditorWindow.h" -//extern MARKERS_MANAGER markersManager; -//extern SELECTION selection; -//extern GREENZONE greenzone; - extern int getInputType(MovieData& md); SNAPSHOT::SNAPSHOT() { + keyFrame = 0; + startFrame = 0; + endFrame = 0; + consecutivenessTag = 0; + recordedJoypadDifferenceBits = 0; + modificationType = 0; + description[0] = 0; } void SNAPSHOT::init(MovieData& md, LAGLOG& lagLog, bool hotchanges, int enforceInputType) diff --git a/src/drivers/Qt/TasEditor/splicer.cpp b/src/drivers/Qt/TasEditor/splicer.cpp index e1f64566..d29c925a 100644 --- a/src/drivers/Qt/TasEditor/splicer.cpp +++ b/src/drivers/Qt/TasEditor/splicer.cpp @@ -37,13 +37,13 @@ extern int joysticksPerFrame[INPUT_TYPES_TOTAL]; // resources static char buttonNames[NUM_JOYPAD_BUTTONS][2] = {"A", "B", "S", "T", "U", "D", "L", "R"}; -static char selectionText[] = "Selection: "; +//static char selectionText[] = "Selection: "; static char selectionEmptyText[] = "no"; static char numTextRow[] = "1 row, "; static char numTextRows[] = " rows, "; static char numTextColumn[] = "1 column"; static char numTextColumns[] = " columns"; -static char clipboardText[] = "Clipboard: "; +//static char clipboardText[] = "Clipboard: "; static char clipboardEmptyText[] = "empty"; SPLICER::SPLICER() @@ -307,7 +307,7 @@ void SPLICER::deleteSelectedFrames(void) bool markers_changed = false; int start_index = *current_selection->begin(); - int end_index = *current_selection->rbegin(); + //int end_index = *current_selection->rbegin(); RowsSelection::reverse_iterator current_selection_rend = current_selection->rend(); // delete frames on each selection, going backwards for(RowsSelection::reverse_iterator it(current_selection->rbegin()); it != current_selection_rend; it++) @@ -476,7 +476,7 @@ bool SPLICER::copySelectedInputToClipboard(RowsSelection* currentSelectionOverri //CloseClipboard(); } - catch (std::bad_alloc e) + catch (std::bad_alloc const &e) { return false; } @@ -648,7 +648,7 @@ bool SPLICER::pasteInsertInputFromClipboard(void) pGlobal = strchr(pGlobal, '\n'); const char* frame; - int joy=0; + //int joy=0; std::vector flash_joy(num_joypads); pos--; while (pGlobal++ && *pGlobal!='\0') diff --git a/src/drivers/Qt/avi/gwavi.cpp b/src/drivers/Qt/avi/gwavi.cpp index 6826f565..9050be9e 100644 --- a/src/drivers/Qt/avi/gwavi.cpp +++ b/src/drivers/Qt/avi/gwavi.cpp @@ -85,6 +85,7 @@ gwavi_t::gwavi_t(void) avi_std = 2; audioEnabled = false; riffWalkCallback = NULL; + riffWalkUserData = NULL; readBuf = NULL; readBufSize = 0; }