RAM Search: fix reset code and update the current values for every addresses.

RAM Search: workaround for auto search restart.

As usual, I need to apply the same fix to every emulators, that uses the same RAM Search code.
This commit is contained in:
gocha 2011-03-21 00:02:23 +00:00
parent 9f31c63d7a
commit 9faea35458
1 changed files with 32 additions and 19 deletions

View File

@ -997,13 +997,22 @@ void CompactAddrs()
ListView_SetItemCount(GetDlgItem(RamSearchHWnd,IDC_RAMLIST),ResultCount);
}
void soft_reset_address_info (bool resetPrevValues = false)
void soft_reset_address_info ()
{
if (resetPrevValues) {
memcpy(buffers->s_prevValues, buffers->s_curValues, sizeof(buffers->s_prevValues));
s_prevValuesNeedUpdate = false;
}
s_prevValuesNeedUpdate = false;
ResetMemoryRegions();
if(!RamSearchHWnd)
{
s_activeMemoryRegions.clear();
ResultCount = 0;
}
else
{
// force s_prevValues to be valid
signal_new_frame();
s_prevValuesNeedUpdate = true;
signal_new_frame();
}
memset(buffers->s_numChanges, 0, sizeof(buffers->s_numChanges));
CompactAddrs();
}
@ -1202,6 +1211,7 @@ void Update_RAM_Search() //keeps RAM values up to date in the search and watch w
// if(disableRamSearchUpdate)
// return;
int prevValuesNeededUpdate;
if (AutoSearch && !ResultCount)
{
if(!AutoSearchAutoRetry)
@ -1217,22 +1227,25 @@ void Update_RAM_Search() //keeps RAM values up to date in the search and watch w
AutoSearchAutoRetry = true;
}
reset_address_info();
prevValuesNeededUpdate = s_prevValuesNeedUpdate;
}
int prevValuesNeededUpdate = s_prevValuesNeedUpdate;
if (RamSearchHWnd)
else
{
// update active RAM values
signal_new_frame();
}
prevValuesNeededUpdate = s_prevValuesNeedUpdate;
if (RamSearchHWnd)
{
// update active RAM values
signal_new_frame();
}
if (AutoSearch && ResultCount)
{
//Clear_Sound_Buffer();
if(!rs_val_valid)
rs_val_valid = Set_RS_Val();
if(rs_val_valid)
prune(rs_c,rs_o,rs_t=='s',rs_val,rs_param);
if (AutoSearch && ResultCount)
{
//Clear_Sound_Buffer();
if(!rs_val_valid)
rs_val_valid = Set_RS_Val();
if(rs_val_valid)
prune(rs_c,rs_o,rs_t=='s',rs_val,rs_param);
}
}
if(RamSearchHWnd)
@ -1703,7 +1716,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd);
int prevNumItems = last_rs_possible;
soft_reset_address_info(true);
soft_reset_address_info();
if(prevNumItems == last_rs_possible)
SetRamSearchUndoType(RamSearchHWnd, 0); // nothing to undo