* RAM Search: added "Hex Editor" button and right-click (#610)

* RAM Watch: fixed bug when loading Recent files
* Taseditor: fixed rerecord counter reset when loading/creating projects
This commit is contained in:
ansstuff 2013-07-05 15:37:57 +00:00
parent da2b1ddb3d
commit e99c791670
6 changed files with 96 additions and 53 deletions

View File

@ -44,6 +44,7 @@
#else
#include "stdint.h"
#endif
#include "memview.h"
bool ShowROM = false;
@ -1111,6 +1112,7 @@ void RefreshRamListSelectedCountControlStatus(HWND hDlg)
{
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_HEXEDITOR), (selCount >= 1) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_C_ELIMINATE), (selCount >= 1) ? TRUE : FALSE);
}
prevSelCount = selCount;
@ -1520,6 +1522,12 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
LPNMHDR lP = (LPNMHDR) lParam;
switch (lP->code)
{
case NM_CUSTOMDRAW:
{
SetWindowLong(hDlg, DWL_MSGRESULT, CustomDraw(lParam));
return TRUE;
}
case LVN_ITEMCHANGED: // selection changed event
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lP;
@ -1529,7 +1537,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// disable buttons that we don't have the right number of selected items for
RefreshRamListSelectedCountControlStatus(hDlg);
}
} break;
break;
}
case LVN_GETDISPINFO:
{
@ -1588,11 +1597,18 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
}
case NM_CUSTOMDRAW:
case NM_RCLICK:
{
SetWindowLong(hDlg, DWL_MSGRESULT, CustomDraw(lParam));
return TRUE;
} break;
// go to the address in Hex Editor
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE)lParam;
int watchItemIndex = lpnmitem->iItem;
if (watchItemIndex >= 0)
{
unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t=='s', noMisalign, watchItemIndex);
ChangeMemViewFocus(0, addr, -1);
}
break;
}
//case LVN_ODCACHEHINT: //Copied this bit from the MSDN virtual listbox code sample. Eventually it should probably do something.
//{
@ -1605,7 +1621,8 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// return 0;
//}
}
} break;
break;
}
case WM_COMMAND:
{
@ -1862,6 +1879,18 @@ invalid_field:
}
{rv = true; break;}
}
case IDC_C_HEXEDITOR:
{
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
int selCount = ListView_GetSelectedCount(ramListControl);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
if (watchItemIndex >= 0)
{
unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t=='s', noMisalign, watchItemIndex);
ChangeMemViewFocus(0, addr, -1);
}
break;
}
case IDC_C_WATCH:
{
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);

View File

@ -422,32 +422,43 @@ void OpenRWRecentFile(int memwRFileNumber)
}
const char DELIM = '\t';
AddressWatcher Temp;
Temp.Address = 0; // default values
Temp.Size = 'b';
Temp.Type = 'h';
char mode;
fgets(Str_Tmp,1024,WatchFile);
sscanf(Str_Tmp,"%c%*s",&mode);
//if ((mode == '1' && !(SegaCD_Started)) || (mode == '2' && !(_32X_Started)))
//{
// char Device[8];
// strcpy(Device,(mode > '1')?"32X":"SegaCD");
// sprintf(Str_Tmp,"Warning: %s not started. \nWatches for %s addresses will be ignored.",Device,Device);
// MessageBox(MESSAGEBOXPARENT,Str_Tmp,"Possible Device Mismatch",MB_OK);
//}
int WatchAdd;
fgets(Str_Tmp,1024,WatchFile);
sscanf(Str_Tmp,"%d%*s",&WatchAdd);
WatchAdd+=WatchCount;
for (int i = WatchCount; i < WatchAdd; i++)
{
while (i < 0)
i++;
do {
fgets(Str_Tmp,1024,WatchFile);
if (i < 0) i = 0;
memset(Str_Tmp, 0, 1024);
do
{
fgets(Str_Tmp, 1024, WatchFile);
} while (Str_Tmp[0] == '\n');
sscanf(Str_Tmp,"%*05X%*c%04X%*c%c%*c%c%*c%d",&(Temp.Address),&(Temp.Size),&(Temp.Type),&(Temp.WrongEndian));
Temp.WrongEndian = 0;
char *Comment = strrchr(Str_Tmp,DELIM) + 1;
*strrchr(Comment,'\n') = '\0';
InsertWatch(Temp,Comment);
sscanf(Str_Tmp, "%*05X%*c%04X%*c%c%*c%c%*c%*c", &(Temp.Address), &(Temp.Size), &(Temp.Type));
Temp.WrongEndian = false;
char *Comment = strrchr(Str_Tmp, DELIM);
if (Comment)
{
Comment++;
char *CommentEnd = strrchr(Comment, '\n');
if (CommentEnd)
{
*CommentEnd = '\0';
InsertWatch(Temp, Comment);
} else
{
// the wch file is probably corrupted
InsertWatch(Temp, Comment);
break;
}
} else
break; // the wch file is probably corrupted
}
fclose(WatchFile);

View File

@ -1819,11 +1819,11 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_RAMLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,9,9,214,151,WS_EX_CLIENTEDGE
PUSHBUTTON "&Search",IDC_C_SEARCH,226,9,52,16
PUSHBUTTON "&Add Cheat",IDC_C_ADDCHEAT,226,145,52,16,WS_DISABLED
PUSHBUTTON "&Watch",IDC_C_WATCH,226,127,52,16
PUSHBUTTON "&Add Cheat",IDC_C_ADDCHEAT,226,130,52,14,WS_DISABLED
PUSHBUTTON "&Watch",IDC_C_WATCH,226,114,52,14
PUSHBUTTON "&Reset",IDC_C_RESET,226,27,52,16
PUSHBUTTON "&Eliminate",IDC_C_ELIMINATE,226,109,52,16
GROUPBOX "Comparison Operator",IDC_STATIC,10,166,102,118,0,WS_EX_TRANSPARENT
PUSHBUTTON "&Eliminate",IDC_C_ELIMINATE,226,98,52,14
GROUPBOX "Comparison Operator",IDC_STATIC,10,166,102,120,0,WS_EX_TRANSPARENT
CONTROL "Less Than",IDC_LESSTHAN,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,14,178,95,11
CONTROL "Greater Than",IDC_MORETHAN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,191,95,11
CONTROL "Less Than or Equal To",IDC_NOMORETHAN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,204,95,11
@ -1834,28 +1834,29 @@ BEGIN
CONTROL "Modulo",IDC_MODULO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,269,35,11
EDITTEXT IDC_EDIT_DIFFBY,69,255,38,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_MODBY,51,267,38,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
GROUPBOX "Compare To / By",IDC_STATIC,118,166,153,58,0,WS_EX_TRANSPARENT
GROUPBOX "Compare To / By",IDC_STATIC,118,166,153,60,0,WS_EX_TRANSPARENT
CONTROL "Previous Value",IDC_PREVIOUSVALUE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,121,176,67,10
CONTROL "Specific Value:",IDC_SPECIFICVALUE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,187,67,10
CONTROL "Specific Address:",IDC_SPECIFICADDRESS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,198,67,10
CONTROL "Number of Changes:",IDC_NUMBEROFCHANGES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,209,76,10
EDITTEXT IDC_EDIT_COMPAREVALUE,203,183,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESS,203,195,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPARECHANGES,203,207,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
GROUPBOX "Data Type / Display",IDC_STATIC,196,227,75,44,0,WS_EX_TRANSPARENT
CONTROL "Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,200,237,67,9
CONTROL "Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,248,67,9
CONTROL "Hexadecimal",IDC_HEX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,259,67,9
CONTROL "Autosearch",IDC_C_AUTOSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,273,52,11
GROUPBOX "Data Size",IDC_STATIC,117,227,73,57,0,WS_EX_TRANSPARENT
CONTROL "1 byte",IDC_1_BYTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,121,237,61,11
CONTROL "2 bytes",IDC_2_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,248,61,11
CONTROL "4 bytes",IDC_4_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,259,61,11
CONTROL "Check Misaligned",IDC_MISALIGN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,121,272,65,8
PUSHBUTTON "&Clear Change Counts",IDC_C_RESET_CHANGES,226,46,52,20,BS_MULTILINE
PUSHBUTTON "&Undo",IDC_C_UNDO,226,69,52,16,WS_DISABLED
CONTROL "Specific Value:",IDC_SPECIFICVALUE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,188,67,10
CONTROL "Specific Address:",IDC_SPECIFICADDRESS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,200,67,10
CONTROL "Number of Changes:",IDC_NUMBEROFCHANGES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,212,76,10
EDITTEXT IDC_EDIT_COMPAREVALUE,203,187,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESS,203,199,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPARECHANGES,203,211,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
GROUPBOX "Data Type / Display",IDC_STATIC,196,228,75,45,0,WS_EX_TRANSPARENT
CONTROL "Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,200,238,67,9
CONTROL "Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,249,67,9
CONTROL "Hexadecimal",IDC_HEX,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,260,67,9
CONTROL "Autosearch",IDC_C_AUTOSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,275,57,11
GROUPBOX "Data Size",IDC_STATIC,117,228,73,58,0,WS_EX_TRANSPARENT
CONTROL "1 byte",IDC_1_BYTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,121,238,61,11
CONTROL "2 bytes",IDC_2_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,249,61,11
CONTROL "4 bytes",IDC_4_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,260,61,11
CONTROL "Check Misaligned",IDC_MISALIGN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,121,273,65,8
PUSHBUTTON "&Clear Change Counts",IDC_C_RESET_CHANGES,226,45,52,20,BS_MULTILINE
PUSHBUTTON "&Undo",IDC_C_UNDO,226,67,52,16,WS_DISABLED
LTEXT "Is",IDC_STATIC,92,270,12,8
CONTROL "Search ROM",IDC_C_SEARCHROM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,226,91,52,11
CONTROL "Search ROM",IDC_C_SEARCHROM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,227,85,54,11
PUSHBUTTON "&Hex Editor",IDC_C_HEXEDITOR,226,146,52,14
END
IDD_RAMWATCH DIALOGEX 0, 0, 269, 298
@ -2133,6 +2134,10 @@ BEGIN
BEGIN
END
IDD_RAMSEARCH, DIALOG
BEGIN
END
IDD_PROMPT, DIALOG
BEGIN
END

View File

@ -679,6 +679,8 @@
#define IDC_C_RESET_CHANGES 1236
#define IDC_C_UNDO 1237
#define IDC_WATCHLIST 1238
#define IDC_C_ELIMINATE2 1238
#define IDC_C_HEXEDITOR 1238
#define IDC_C_WATCH_EDIT 1239
#define IDC_C_WATCH_REMOVE 1240
#define IDC_C_WATCH_DUPLICATE 1241

View File

@ -822,7 +822,7 @@ void PowerNES(void) {
#endif
FCEU_PowerCheats();
LagCounterReset();
// clear back baffer
// clear back buffer
extern uint8 *XBackBuf;
memset(XBackBuf, 0, 256 * 256);

View File

@ -103,7 +103,6 @@ SFORMAT FCEUMOV_STATEINFO[]={
char curMovieFilename[512] = {0};
MovieData currMovieData;
MovieData defaultMovieData;
int currRerecordCount;
char lagcounterbuf[32] = {0};
@ -903,7 +902,6 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, int _pauseframe)
pauseframe = _pauseframe;
movie_readonly = _read_only;
movieMode = MOVIEMODE_PLAY;
currRerecordCount = currMovieData.rerecordCount;
if(movie_readonly)
FCEU_DispMessage("Replay started Read-Only.",0);
@ -974,7 +972,6 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
movieMode = MOVIEMODE_RECORD;
movie_readonly = false;
currRerecordCount = 0;
FCEU_DispMessage("Movie recording started.",0);
}
@ -1409,11 +1406,10 @@ void FCEUMOV_IncrementRerecordCount()
{
#ifdef _S9XLUA_H
if(!FCEU_LuaRerecordCountSkip())
currRerecordCount++;
currMovieData.rerecordCount++;
#else
currRerecordCount++;
currMovieData.rerecordCount++;
#endif
currMovieData.rerecordCount = currRerecordCount;
}
void FCEUI_MovieToggleFrameDisplay(void)