0.9.6: update ram tools and cheat list
This commit is contained in:
parent
36da18aec6
commit
9f84be2c3a
|
@ -213,7 +213,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
|
|||
else
|
||||
{
|
||||
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), "0");
|
||||
CheckDlgButton(dialog, IDC_RADIO1, BST_CHECKED);
|
||||
CheckRadioButton(dialog, IDC_RADIO1, IDC_RADIO4, IDC_RADIO1);
|
||||
}
|
||||
|
||||
memset(editBuf, 0, sizeof(editBuf));
|
||||
|
@ -228,7 +228,7 @@ INT_PTR CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
|
|||
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 12);
|
||||
|
||||
CheckDlgButton(dialog, IDC_CHECK1, BST_CHECKED);
|
||||
CheckDlgButton(dialog, searchSizeIDDs[searchAddSize], BST_CHECKED);
|
||||
CheckRadioButton(dialog, searchSizeIDDs[0], searchSizeIDDs[ARRAY_SIZE(searchSizeIDDs) - 1], searchSizeIDDs[searchAddSize]);
|
||||
|
||||
if(searchAddMode == 2)
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ INT_PTR CALLBACK CheatsEditProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lpara
|
|||
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 12);
|
||||
|
||||
CheckDlgButton(dialog, IDC_CHECK1, tempCheat.enabled?BST_CHECKED:BST_UNCHECKED);
|
||||
CheckDlgButton(dialog, searchSizeIDDs[tempCheat.size], BST_CHECKED);
|
||||
CheckRadioButton(dialog, searchSizeIDDs[0], searchSizeIDDs[ARRAY_SIZE(searchSizeIDDs) - 1], searchSizeIDDs[tempCheat.size]);
|
||||
SetWindowText(GetDlgItem(dialog, IDOK), "Update");
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -669,14 +669,15 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
|
||||
cheatListView = GetDlgItem(dialog, IDC_LIST1);
|
||||
|
||||
ListView_SetExtendedListViewStyle(cheatListView, LVS_EX_FULLROWSELECT | LVS_EX_TWOCLICKACTIVATE);
|
||||
//ListView_SetExtendedListViewStyle(GetDlgItem(hDlg, IDC_CHEAT_LIST), LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES);
|
||||
ListView_SetExtendedListViewStyle(cheatListView, LVS_EX_FULLROWSELECT | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES);
|
||||
|
||||
memset(&lvColumn,0,sizeof(LV_COLUMN));
|
||||
lvColumn.mask=LVCF_FMT|LVCF_WIDTH|LVCF_TEXT;
|
||||
|
||||
lvColumn.fmt=LVCFMT_CENTER;
|
||||
lvColumn.cx=20;
|
||||
lvColumn.pszText="X";
|
||||
lvColumn.pszText="";
|
||||
ListView_InsertColumn(cheatListView, 0, &lvColumn);
|
||||
|
||||
lvColumn.fmt=LVCFMT_LEFT;
|
||||
|
@ -701,15 +702,13 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
while (cheats->getList(&tempCheat))
|
||||
{
|
||||
char buf[256];
|
||||
if (tempCheat.enabled)
|
||||
lvi.pszText= "X";
|
||||
else
|
||||
lvi.pszText= "";
|
||||
lvi.pszText= "";
|
||||
switch (tempCheat.type)
|
||||
{
|
||||
case 0: // Internal
|
||||
{
|
||||
u32 row = ListView_InsertItem(cheatListView, &lvi);
|
||||
ListView_SetCheckState(cheatListView, row, tempCheat.enabled);
|
||||
wsprintf(buf, "0x02%06X", tempCheat.code[0][0]);
|
||||
ListView_SetItemText(cheatListView, row, 1, buf);
|
||||
ltoa(tempCheat.code[0][1], buf, 10);
|
||||
|
@ -721,6 +720,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
case 1: // Action Replay
|
||||
{
|
||||
u32 row = ListView_InsertItem(cheatListView, &lvi);
|
||||
ListView_SetCheckState(cheatListView, row, tempCheat.enabled);
|
||||
ListView_SetItemText(cheatListView, row, 1, "Action");
|
||||
ListView_SetItemText(cheatListView, row, 2, "Replay");
|
||||
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
|
||||
|
@ -730,6 +730,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
case 2: // Codebreaker
|
||||
{
|
||||
u32 row = ListView_InsertItem(cheatListView, &lvi);
|
||||
ListView_SetCheckState(cheatListView, row, tempCheat.enabled);
|
||||
ListView_SetItemText(cheatListView, row, 1, "Code");
|
||||
ListView_SetItemText(cheatListView, row, 2, "breaker");
|
||||
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
|
||||
|
@ -739,6 +740,8 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
}
|
||||
SendMessage(cheatListView, WM_SETREDRAW, (WPARAM)TRUE,0);
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
|
||||
|
||||
ListView_SetItemState(searchListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
||||
SetFocus(searchListView);
|
||||
return TRUE;
|
||||
|
@ -748,46 +751,50 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
if (wparam == IDC_LIST1)
|
||||
{
|
||||
LPNMHDR tmp_msg = (LPNMHDR)lparam;
|
||||
if ( tmp_msg->code == LVN_ITEMACTIVATE )
|
||||
switch (tmp_msg->code)
|
||||
{
|
||||
cheatEditPos = ListView_GetNextItem(cheatListView, -1, LVNI_SELECTED|LVNI_FOCUSED);
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
tempCheat.enabled = !tempCheat.enabled;
|
||||
switch (tempCheat.type)
|
||||
case LVN_ITEMCHANGED:
|
||||
{
|
||||
case 0: // internal
|
||||
cheats->update(tempCheat.size, tempCheat.code[0][0], tempCheat.code[0][1], tempCheat.description, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lparam;
|
||||
if(pNMListView->uNewState & LVIS_FOCUSED ||
|
||||
(pNMListView->uOldState ^ pNMListView->uNewState) & LVIS_SELECTED) // on selection changed
|
||||
{
|
||||
int selCount = ListView_GetSelectedCount(cheatListView);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BEDIT), (selCount == 1) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BREMOVE), (selCount >= 1) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
case 1: // Action Replay
|
||||
cheats->update_AR(NULL, NULL, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
UINT oldStateImage = pNMListView->uOldState & LVIS_STATEIMAGEMASK;
|
||||
UINT newStateImage = pNMListView->uNewState & LVIS_STATEIMAGEMASK;
|
||||
if(oldStateImage != newStateImage &&
|
||||
(oldStateImage == INDEXTOSTATEIMAGEMASK(1) || oldStateImage == INDEXTOSTATEIMAGEMASK(2)) &&
|
||||
(newStateImage == INDEXTOSTATEIMAGEMASK(1) || newStateImage == INDEXTOSTATEIMAGEMASK(2))) // on checked changed
|
||||
{
|
||||
bool checked = (newStateImage == INDEXTOSTATEIMAGEMASK(2));
|
||||
cheatEditPos = pNMListView->iItem;
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
if ((bool)tempCheat.enabled != checked)
|
||||
{
|
||||
tempCheat.enabled = checked;
|
||||
switch (tempCheat.type)
|
||||
{
|
||||
case 0: // internal
|
||||
cheats->update(tempCheat.size, tempCheat.code[0][0], tempCheat.code[0][1], tempCheat.description, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
|
||||
case 2: // Codebreaker
|
||||
cheats->update_CB(NULL, NULL, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (tempCheat.enabled)
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 0, "X")
|
||||
else
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 0, "");
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
|
||||
if ( tmp_msg->code == NM_CLICK )
|
||||
{
|
||||
if (ListView_GetNextItem(cheatListView, -1, LVNI_SELECTED|LVNI_FOCUSED) != -1)
|
||||
{
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BEDIT), TRUE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BREMOVE), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BEDIT), FALSE);
|
||||
EnableWindow(GetDlgItem(dialog, IDC_BREMOVE), FALSE);
|
||||
case 1: // Action Replay
|
||||
cheats->update_AR(NULL, NULL, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
|
||||
case 2: // Codebreaker
|
||||
cheats->update_CB(NULL, NULL, tempCheat.enabled, cheatEditPos);
|
||||
break;
|
||||
}
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -825,16 +832,13 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
lvi.mask = LVIF_TEXT|LVIF_STATE;
|
||||
lvi.iItem = INT_MAX;
|
||||
|
||||
if (searchAddFreeze)
|
||||
lvi.pszText= "X";
|
||||
else
|
||||
lvi.pszText= " ";
|
||||
u32 row = ListView_InsertItem(cheatListView, &lvi);
|
||||
wsprintf(buf, "0x02%06X", searchAddAddress);
|
||||
ListView_SetItemText(cheatListView, row, 1, buf);
|
||||
ltoa(searchAddValue, buf, 10);
|
||||
ListView_SetItemText(cheatListView, row, 2, buf);
|
||||
ListView_SetItemText(cheatListView, row, 3, editBuf[2]);
|
||||
ListView_SetCheckState(cheatListView, row, searchAddFreeze);
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
|
@ -864,10 +868,6 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
lvi.mask = LVIF_TEXT|LVIF_STATE;
|
||||
lvi.iItem = INT_MAX;
|
||||
|
||||
if (tempCheat.enabled)
|
||||
lvi.pszText= "X";
|
||||
else
|
||||
lvi.pszText= " ";
|
||||
u32 row = ListView_InsertItem(cheatListView, &lvi);
|
||||
if (cheatXXtype == 0)
|
||||
{
|
||||
|
@ -880,6 +880,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
ListView_SetItemText(cheatListView, row, 2, "breaker");
|
||||
}
|
||||
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
|
||||
ListView_SetCheckState(cheatListView, row, tempCheat.enabled);
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
|
@ -900,8 +901,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
{
|
||||
char buf[256];
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
if (tempCheat.enabled)
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 0, "X");
|
||||
ListView_SetCheckState(cheatListView, cheatEditPos, tempCheat.enabled);
|
||||
wsprintf(buf, "0x02%06X", tempCheat.code[0][0]);
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 1, buf);
|
||||
ltoa(tempCheat.code[0][1], buf, 10);
|
||||
|
@ -922,8 +922,7 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
if (DialogBoxW(hAppInst, MAKEINTRESOURCEW(IDD_CHEAT_ADD_XX_CODE), dialog, (DLGPROC) CheatsAdd_XX_Proc))
|
||||
{
|
||||
cheats->get(&tempCheat, cheatEditPos);
|
||||
if (tempCheat.enabled)
|
||||
ListView_SetItemText(cheatListView, cheatEditPos, 0, "X");
|
||||
ListView_SetCheckState(cheatListView, cheatEditPos, tempCheat.enabled);
|
||||
|
||||
if (cheatXXtype == 0)
|
||||
{
|
||||
|
@ -946,16 +945,19 @@ INT_PTR CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM l
|
|||
|
||||
case IDC_BREMOVE:
|
||||
{
|
||||
int tmp_pos = ListView_GetNextItem(cheatListView, -1, LVNI_SELECTED|LVNI_FOCUSED);
|
||||
if (tmp_pos != -1)
|
||||
while(true)
|
||||
{
|
||||
int tmp_pos = ListView_GetNextItem(cheatListView, -1, LVNI_ALL | LVNI_SELECTED);
|
||||
if (tmp_pos == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (cheats->remove(tmp_pos))
|
||||
{
|
||||
ListView_DeleteItem(cheatListView, tmp_pos);
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -997,8 +999,7 @@ void CheatsAddDialog(HWND parentHwnd, u32 address, u32 value, u8 size, const cha
|
|||
//
|
||||
//char buf[256];
|
||||
//cheats->get(&tempCheat, cheatEditPos);
|
||||
//if (tempCheat.enabled)
|
||||
// ListView_SetItemText(cheatListView, cheatEditPos, 0, "X");
|
||||
//ListView_SetCheckState(cheatListView, cheatEditPos, 0, tempCheat.enabled);
|
||||
//wsprintf(buf, "0x02%06X", tempCheat.code[0][0]);
|
||||
//ListView_SetItemText(cheatListView, cheatEditPos, 1, buf);
|
||||
//ltoa(tempCheat.code[0][1], buf, 10);
|
||||
|
@ -1080,8 +1081,8 @@ INT_PTR CALLBACK CheatsSearchCompWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM
|
|||
EnableWindow(hBView, FALSE);
|
||||
EnableWindow(hBSearch, TRUE);
|
||||
|
||||
CheckDlgButton(dialog, searchCompIDDs[searchComp], BST_CHECKED);
|
||||
|
||||
CheckRadioButton(dialog, searchCompIDDs[0], searchCompIDDs[ARRAY_SIZE(searchCompIDDs) - 1], searchCompIDDs[searchComp]);
|
||||
|
||||
char buf[256];
|
||||
ltoa(searchNumberResults, buf, 10);
|
||||
SetWindowText(GetDlgItem(dialog, IDC_SNUMBER), buf);
|
||||
|
@ -1205,9 +1206,9 @@ INT_PTR CALLBACK CheatsSearchMainWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM
|
|||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
CheckDlgButton(dialog, searchSizeIDDs[searchSize], BST_CHECKED);
|
||||
CheckDlgButton(dialog, searchSignIDDs[searchSign], BST_CHECKED);
|
||||
CheckDlgButton(dialog, searchTypeIDDs[searchType], BST_CHECKED);
|
||||
CheckRadioButton(dialog, searchSizeIDDs[0], searchSizeIDDs[ARRAY_SIZE(searchSizeIDDs) - 1], searchSizeIDDs[searchSize]);
|
||||
CheckRadioButton(dialog, searchSignIDDs[0], searchSignIDDs[ARRAY_SIZE(searchSignIDDs) - 1], searchSignIDDs[searchSign]);
|
||||
CheckRadioButton(dialog, searchTypeIDDs[0], searchTypeIDDs[ARRAY_SIZE(searchTypeIDDs) - 1], searchTypeIDDs[searchType]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
SetWindowText(GetDlgItem(dialog, searchRangeIDDs[i]), searchRangeText[searchSign][i]);
|
||||
EnableWindow(hBRestart, FALSE);
|
||||
|
|
|
@ -1049,8 +1049,8 @@ void RefreshRamListSelectedCountControlStatus(HWND hDlg)
|
|||
{
|
||||
if(selCount < 2 || prevSelCount < 2)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_C_WATCH), (selCount == 1 && WatchCount < MAX_WATCH_COUNT) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_C_ADDCHEAT), (selCount == 1) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_C_WATCH), (selCount >= 1 && WatchCount < MAX_WATCH_COUNT) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_C_ADDCHEAT), (selCount >= 1) ? TRUE : FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_C_ELIMINATE), (selCount >= 1) ? TRUE : FALSE);
|
||||
}
|
||||
prevSelCount = selCount;
|
||||
|
@ -1485,7 +1485,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
case LVN_ITEMCHANGED: // selection changed event
|
||||
{
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lP;
|
||||
if(pNMListView->uNewState & LVIS_FOCUSED)
|
||||
if(pNMListView->uNewState & LVIS_FOCUSED ||
|
||||
(pNMListView->uNewState ^ pNMListView->uOldState) & LVIS_SELECTED)
|
||||
{
|
||||
// disable buttons that we don't have the right number of selected items for
|
||||
RefreshRamListSelectedCountControlStatus(hDlg);
|
||||
|
@ -1688,13 +1689,15 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
} {rv = true; break;}
|
||||
case IDC_C_ADDCHEAT:
|
||||
{
|
||||
int cheatItemIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST));
|
||||
if(cheatItemIndex >= 0)
|
||||
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
|
||||
int cheatItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
|
||||
while (cheatItemIndex >= 0)
|
||||
{
|
||||
u32 address = CALL_WITH_T_SIZE_TYPES(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, cheatItemIndex);
|
||||
u8 size = (rs_type_size=='b') ? 1 : (rs_type_size=='w' ? 2 : 4);
|
||||
u32 value = CALL_WITH_T_SIZE_TYPES(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, cheatItemIndex);
|
||||
CheatsAddDialog(hDlg, address, value, size);
|
||||
cheatItemIndex = ListView_GetNextItem(ramListControl, cheatItemIndex, LVNI_SELECTED);
|
||||
}
|
||||
{rv = true; break;}
|
||||
}
|
||||
|
@ -1781,8 +1784,12 @@ invalid_field:
|
|||
}
|
||||
case IDC_C_WATCH:
|
||||
{
|
||||
int watchItemIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST));
|
||||
if(watchItemIndex >= 0)
|
||||
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
|
||||
int selCount = ListView_GetSelectedCount(ramListControl);
|
||||
|
||||
bool inserted = false;
|
||||
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
|
||||
while (watchItemIndex >= 0)
|
||||
{
|
||||
AddressWatcher tempWatch;
|
||||
tempWatch.Address = CALL_WITH_T_SIZE_TYPES(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, watchItemIndex);
|
||||
|
@ -1791,14 +1798,17 @@ invalid_field:
|
|||
tempWatch.WrongEndian = 0; //Replace when I get little endian working
|
||||
tempWatch.comment = NULL;
|
||||
|
||||
bool inserted = InsertWatch(tempWatch, hDlg);
|
||||
//ListView_Update(GetDlgItem(hDlg,IDC_RAMLIST), -1);
|
||||
if (selCount == 1)
|
||||
inserted |= InsertWatch(tempWatch, hDlg);
|
||||
else
|
||||
inserted |= InsertWatch(tempWatch, "");
|
||||
|
||||
// bring up the ram watch window if it's not already showing so the user knows where the watch went
|
||||
if(inserted && !RamWatchHWnd)
|
||||
SendMessage(MainWindow->getHWnd(), WM_COMMAND, ID_RAM_WATCH, 0);
|
||||
SetForegroundWindow(RamSearchHWnd);
|
||||
watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED);
|
||||
}
|
||||
// bring up the ram watch window if it's not already showing so the user knows where the watch went
|
||||
if(inserted && !RamWatchHWnd)
|
||||
SendMessage(MainWindow->getHWnd(), WM_COMMAND, ID_RAM_WATCH, 0);
|
||||
SetForegroundWindow(RamSearchHWnd);
|
||||
{rv = true; break;}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ int WatchCount=0;
|
|||
bool QuickSaveWatches();
|
||||
bool ResetWatches();
|
||||
|
||||
void RefreshWatchListSelectedCountControlStatus(HWND hDlg);
|
||||
|
||||
unsigned int GetCurrentValue(AddressWatcher& watch)
|
||||
{
|
||||
char buf[4];
|
||||
|
@ -547,8 +549,10 @@ bool Load_Watches(bool clear, const char* filename)
|
|||
}
|
||||
|
||||
fclose(WatchFile);
|
||||
if (RamWatchHWnd)
|
||||
if (RamWatchHWnd) {
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
|
||||
RefreshWatchListSelectedCountControlStatus(RamWatchHWnd);
|
||||
}
|
||||
RWfileChanged=false;
|
||||
return true;
|
||||
}
|
||||
|
@ -608,8 +612,10 @@ bool ResetWatches()
|
|||
rswatches[WatchCount].comment = NULL;
|
||||
}
|
||||
WatchCount++;
|
||||
if (RamWatchHWnd)
|
||||
if (RamWatchHWnd) {
|
||||
ListView_SetItemCount(GetDlgItem(RamWatchHWnd,IDC_WATCHLIST),WatchCount);
|
||||
RefreshWatchListSelectedCountControlStatus(RamWatchHWnd);
|
||||
}
|
||||
RWfileChanged = false;
|
||||
currentWatch[0] = NULL;
|
||||
return true;
|
||||
|
@ -785,6 +791,38 @@ void init_list_box(HWND Box, const char* Strs[], int numColumns, int *columnWidt
|
|||
ListView_SetExtendedListViewStyle(Box, LVS_EX_FULLROWSELECT);
|
||||
}
|
||||
|
||||
void RamWatchEnableCommand(HWND hDlg, HMENU hMenu, UINT uIDEnableItem, bool enable)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hDlg, uIDEnableItem), (enable?TRUE:FALSE));
|
||||
if (hMenu != NULL) {
|
||||
if (uIDEnableItem == ID_WATCHES_UPDOWN) {
|
||||
EnableMenuItem(hMenu, IDC_C_WATCH_UP, MF_BYCOMMAND | (enable?MF_ENABLED:MF_GRAYED));
|
||||
EnableMenuItem(hMenu, IDC_C_WATCH_DOWN, MF_BYCOMMAND | (enable?MF_ENABLED:MF_GRAYED));
|
||||
}
|
||||
else
|
||||
EnableMenuItem(hMenu, uIDEnableItem, MF_BYCOMMAND | (enable?MF_ENABLED:MF_GRAYED));
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshWatchListSelectedCountControlStatus(HWND hDlg)
|
||||
{
|
||||
static int prevSelCount=-1;
|
||||
int selCount = ListView_GetSelectedCount(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
if(selCount != prevSelCount)
|
||||
{
|
||||
if(selCount < 2 || prevSelCount < 2)
|
||||
{
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_EDIT, selCount == 1);
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_REMOVE, selCount >= 1);
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH, selCount == 1);
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_DUPLICATE, selCount == 1);
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_ADDCHEAT, selCount == 1);
|
||||
RamWatchEnableCommand(hDlg, ramwatchmenu, ID_WATCHES_UPDOWN, selCount == 1);
|
||||
}
|
||||
prevSelCount = selCount;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT r;
|
||||
|
@ -865,6 +903,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
Update_RAM_Watch();
|
||||
DragAcceptFiles(hDlg, TRUE);
|
||||
|
||||
RefreshWatchListSelectedCountControlStatus(hDlg);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
@ -898,6 +937,17 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
LPNMHDR lP = (LPNMHDR) lParam;
|
||||
switch (lP->code)
|
||||
{
|
||||
case LVN_ITEMCHANGED: // selection changed event
|
||||
{
|
||||
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lP;
|
||||
if(pNMListView->uNewState & LVIS_FOCUSED ||
|
||||
(pNMListView->uNewState ^ pNMListView->uOldState) & LVIS_SELECTED)
|
||||
{
|
||||
// disable buttons that we don't have the right number of selected items for
|
||||
RefreshWatchListSelectedCountControlStatus(hDlg);
|
||||
}
|
||||
} break;
|
||||
|
||||
case LVN_GETDISPINFO:
|
||||
{
|
||||
LV_DISPINFO *Item = (LV_DISPINFO *)lParam;
|
||||
|
@ -966,15 +1016,19 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
ResetWatches();
|
||||
return true;
|
||||
case IDC_C_WATCH_REMOVE:
|
||||
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
if(watchIndex != -1)
|
||||
{
|
||||
HWND watchListControl = GetDlgItem(hDlg, IDC_WATCHLIST);
|
||||
watchIndex = ListView_GetNextItem(watchListControl, -1, LVNI_ALL | LVNI_SELECTED);
|
||||
while (watchIndex >= 0)
|
||||
{
|
||||
RemoveWatch(watchIndex);
|
||||
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);
|
||||
RWfileChanged=true;
|
||||
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
ListView_DeleteItem(watchListControl, watchIndex);
|
||||
watchIndex = ListView_GetNextItem(watchListControl, -1, LVNI_ALL | LVNI_SELECTED);
|
||||
}
|
||||
RWfileChanged=true;
|
||||
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
return true;
|
||||
}
|
||||
case IDC_C_WATCH_EDIT:
|
||||
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
|
||||
if(watchIndex != -1)
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue