diff --git a/src/debug.cpp b/src/debug.cpp index 90cc7cbf..578e5e9a 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -616,78 +616,127 @@ void breakpoint() case 0x60: stackopstartaddr=X.S+1; stackopendaddr=X.S+2; stackop=WP_R; StackAddrBackup = X.S; StackNextIgnorePC=(GetMem(stackopstartaddr|0x0100)|GetMem(stackopendaddr|0x0100)<<8)+1; break; } - for (i = 0; i < numWPs; i++) { + for (i = 0; i < numWPs; i++) + { // ################################## Start of SP CODE ########################### - if (condition(&watchpoint[i])) + if ((watchpoint[i].flags & WP_E) && condition(&watchpoint[i])) { // ################################## End of SP CODE ########################### - if (watchpoint[i].flags & BT_P) { //PPU Mem breaks - if ((watchpoint[i].flags & WP_E) && (watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 7)) { - if (watchpoint[i].endaddress) { - if ((watchpoint[i].address <= RefreshAddr) && (watchpoint[i].endaddress >= RefreshAddr)) BreakHit(i); + if (watchpoint[i].flags & BT_P) + { + // PPU Mem breaks + if ((watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 7)) + { + if (watchpoint[i].endaddress) + { + if ((watchpoint[i].address <= RefreshAddr) && (watchpoint[i].endaddress >= RefreshAddr)) + BreakHit(i); + } else + { + if (watchpoint[i].address == RefreshAddr) + BreakHit(i); } - else if (watchpoint[i].address == RefreshAddr) BreakHit(i); } - } - else if (watchpoint[i].flags & BT_S) { //Sprite Mem breaks - if ((watchpoint[i].flags & WP_E) && (watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 4)) { - if (watchpoint[i].endaddress) { - if ((watchpoint[i].address <= PPU[3]) && (watchpoint[i].endaddress >= PPU[3])) BreakHit(i); + } else if (watchpoint[i].flags & BT_S) + { + // Sprite Mem breaks + if ((watchpoint[i].flags & brk_type) && ((A >= 0x2000) && (A < 0x4000)) && ((A&7) == 4)) + { + if (watchpoint[i].endaddress) + { + if ((watchpoint[i].address <= PPU[3]) && (watchpoint[i].endaddress >= PPU[3])) + BreakHit(i); + } else + { + if (watchpoint[i].address == PPU[3]) + BreakHit(i); } - else if (watchpoint[i].address == PPU[3]) BreakHit(i); + } else if ((watchpoint[i].flags & WP_W) && (A == 0x4014)) + { + // Sprite DMA! :P + BreakHit(i); } - else if ((watchpoint[i].flags & WP_E) && (watchpoint[i].flags & WP_W) && (A == 0x4014)) BreakHit(i); //Sprite DMA! :P - } - else { //CPU mem breaks - if ((watchpoint[i].flags & WP_E) && (watchpoint[i].flags & brk_type)) { - if (watchpoint[i].endaddress) { + } else + { + // CPU mem breaks + if ((watchpoint[i].flags & brk_type)) + { + if (watchpoint[i].endaddress) + { if (((watchpoint[i].flags & (WP_R | WP_W)) && (watchpoint[i].address <= A) && (watchpoint[i].endaddress >= A)) || - ((watchpoint[i].flags & WP_X) && (watchpoint[i].address <= _PC) && (watchpoint[i].endaddress >= _PC))) BreakHit(i); + ((watchpoint[i].flags & WP_X) && (watchpoint[i].address <= _PC) && (watchpoint[i].endaddress >= _PC))) + BreakHit(i); + } else + { + if (((watchpoint[i].flags & (WP_R | WP_W)) && (watchpoint[i].address == A)) || + ((watchpoint[i].flags & WP_X) && (watchpoint[i].address == _PC))) + BreakHit(i); } - else if (((watchpoint[i].flags & (WP_R | WP_W)) && (watchpoint[i].address == A)) || - ((watchpoint[i].flags & WP_X) && (watchpoint[i].address == _PC))) BreakHit(i); - } - else if (watchpoint[i].flags & WP_E) { - //brk_type independant coding - - if (stackop>0) { - //Announced stack mem breaks - //PHA, PLA, PHP, and PLP affect the stack data. - //TXS and TSX only deal with the pointer. - if (watchpoint[i].flags & stackop) { - for (j = (stackopstartaddr|0x0100); j <= (stackopendaddr|0x0100); j++) { - if (watchpoint[i].endaddress) { - if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) BreakHit(i); + } else + { + // brk_type independant coding + if (stackop > 0) + { + // Announced stack mem breaks + // PHA, PLA, PHP, and PLP affect the stack data. + // TXS and TSX only deal with the pointer. + if (watchpoint[i].flags & stackop) + { + for (j = (stackopstartaddr|0x0100); j <= (stackopendaddr|0x0100); j++) + { + if (watchpoint[i].endaddress) + { + if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) + BreakHit(i); + } else + { + if (watchpoint[i].address == j) + BreakHit(i); } - else if (watchpoint[i].address == j) BreakHit(i); } } } - if (StackNextIgnorePC==_PC) { - //Used to make it ignore the unannounced stack code one time + if (StackNextIgnorePC == _PC) + { + // Used to make it ignore the unannounced stack code one time StackNextIgnorePC = 0xFFFF; } else { - if ((X.S < StackAddrBackup) && (stackop==0)) { - //Unannounced stack mem breaks - //Pushes to stack - if (watchpoint[i].flags & WP_W) { - for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++) { - if (watchpoint[i].endaddress) { - if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) BreakHit(i); + if ((X.S < StackAddrBackup) && (stackop==0)) + { + // Unannounced stack mem breaks + // Pushes to stack + if (watchpoint[i].flags & WP_W) + { + for (j = (X.S|0x0100); j < (StackAddrBackup|0x0100); j++) + { + if (watchpoint[i].endaddress) + { + if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) + BreakHit(i); + } else + { + if (watchpoint[i].address == j) + BreakHit(i); } - else if (watchpoint[i].address == j) BreakHit(i); } } - } - else if ((StackAddrBackup < X.S) && (stackop==0)) { - //Pulls from stack - if (watchpoint[i].flags & WP_R) { - for (j = (StackAddrBackup|0x0100); j < (X.S|0x0100); j++) { - if (watchpoint[i].endaddress) { - if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) BreakHit(i); + } else if ((StackAddrBackup < X.S) && (stackop==0)) + { + // Pulls from stack + if (watchpoint[i].flags & WP_R) + { + for (j = (StackAddrBackup|0x0100); j < (X.S|0x0100); j++) + { + if (watchpoint[i].endaddress) + { + if ((watchpoint[i].address <= j) && (watchpoint[i].endaddress >= j)) + BreakHit(i); + } else + { + if (watchpoint[i].address == j) + BreakHit(i); } - else if (watchpoint[i].address == j) BreakHit(i); } } } diff --git a/src/drivers/win/taseditor.cpp b/src/drivers/win/taseditor.cpp index e640c8b5..d1516b01 100644 --- a/src/drivers/win/taseditor.cpp +++ b/src/drivers/win/taseditor.cpp @@ -801,7 +801,7 @@ void ApplyMovieInputConfig() // this getter contains formula to decide whether to record or replay movie bool TaseditorIsRecording() { - if (movie_readonly || playback.GetPauseFrame() >= 0) + if (movie_readonly || playback.GetPauseFrame() >= 0 || (taseditor_config.old_branching_controls && !recorder.state_was_loaded_in_readwrite_mode)) return false; // replay return true; // record } diff --git a/src/drivers/win/taseditor/bookmarks.cpp b/src/drivers/win/taseditor/bookmarks.cpp index c5d751f7..2bc0d614 100644 --- a/src/drivers/win/taseditor/bookmarks.cpp +++ b/src/drivers/win/taseditor/bookmarks.cpp @@ -32,6 +32,7 @@ extern TASEDITOR_CONFIG taseditor_config; extern TASEDITOR_WINDOW taseditor_window; extern POPUP_DISPLAY popup_display; extern PLAYBACK playback; +extern RECORDER recorder; extern SELECTION selection; extern GREENZONE greenzone; extern TASEDITOR_PROJECT project; @@ -398,6 +399,7 @@ void BOOKMARKS::jump(int slot) void BOOKMARKS::deploy(int slot) { + recorder.state_was_loaded_in_readwrite_mode = true; if (taseditor_config.old_branching_controls && movie_readonly) { jump(slot); diff --git a/src/drivers/win/taseditor/branches.cpp b/src/drivers/win/taseditor/branches.cpp index d715c16f..b9b9d277 100644 --- a/src/drivers/win/taseditor/branches.cpp +++ b/src/drivers/win/taseditor/branches.cpp @@ -76,7 +76,7 @@ void BRANCHES::init() hOldBitmap1 = (HBITMAP)SelectObject(hBufferDC, buffer_hbitmap); normal_brush = CreateSolidBrush(0x000000); border_brush = CreateSolidBrush(0xb99d7f); - selected_slot_brush = CreateSolidBrush(0x6161E4); + selected_slot_brush = CreateSolidBrush(0x5656CA); // prepare bg gradient vertex[0].x = 0; vertex[0].y = 0; diff --git a/src/drivers/win/taseditor/recorder.cpp b/src/drivers/win/taseditor/recorder.cpp index d7ca196a..8e003af6 100644 --- a/src/drivers/win/taseditor/recorder.cpp +++ b/src/drivers/win/taseditor/recorder.cpp @@ -70,6 +70,7 @@ void RECORDER::init() void RECORDER::reset() { movie_readonly = true; + state_was_loaded_in_readwrite_mode = false; multitrack_recording_joypad = MULTITRACK_RECORDING_ALL; pattern_offset = 0; must_increase_pattern_offset = false; @@ -121,6 +122,8 @@ void RECORDER::update() { Button_SetCheck(hwndRecCheckbox, movie_readonly?BST_UNCHECKED : BST_CHECKED); old_movie_readonly = movie_readonly; + if (movie_readonly) + state_was_loaded_in_readwrite_mode = false; } // reset pattern_offset if current_pattern has changed if (old_current_pattern != taseditor_config.current_pattern) diff --git a/src/drivers/win/taseditor/recorder.h b/src/drivers/win/taseditor/recorder.h index c644999f..c343e83a 100644 --- a/src/drivers/win/taseditor/recorder.h +++ b/src/drivers/win/taseditor/recorder.h @@ -35,6 +35,7 @@ public: int multitrack_recording_joypad; int pattern_offset; std::vector current_joy; + bool state_was_loaded_in_readwrite_mode; private: int old_multitrack_recording_joypad;