commit
8a3edc18e3
|
@ -12,6 +12,7 @@ using namespace std;
|
|||
#include <commctrl.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
|
||||
/*
|
||||
#include <commctrl.h>
|
||||
|
@ -825,6 +826,9 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
case 'h':
|
||||
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
|
||||
break;
|
||||
case 'b':
|
||||
SendDlgItemMessage(hDlg, IDC_BINARY, BM_SETCHECK, BST_CHECKED, 0);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "---------");
|
||||
|
@ -844,6 +848,7 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
EnableWindow(GetDlgItem(hDlg, IDC_SIGNED), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_UNSIGNED), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_HEX), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_BINARY), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_1_BYTE), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_2_BYTES), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
|
||||
|
@ -886,6 +891,8 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
watcher.Type = 'u';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'h';
|
||||
else if (SendDlgItemMessage(hDlg, IDC_BINARY, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
watcher.Type = 'b';
|
||||
else {
|
||||
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
|
@ -903,6 +910,12 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
return true;
|
||||
}
|
||||
|
||||
if (watcher.Type == 'b' && (watcher.Size == 'd' || watcher.Size == 'w'))
|
||||
{
|
||||
MessageBox(hDlg, "Only 1 byte is supported on binary format.", "Error", MB_OK | MB_ICONERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
// address
|
||||
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
|
||||
char *addrstr = Str_Tmp;
|
||||
|
@ -1129,6 +1142,18 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
int i = rswatches[iNum].CurValue;
|
||||
int t = rswatches[iNum].Type;
|
||||
int size = rswatches[iNum].Size;
|
||||
if (rswatches[iNum].Type == 'b')
|
||||
{
|
||||
auto bits = bitset<8>(i); // Currently work with 1 byte size only
|
||||
int j = 0, k = 7;
|
||||
while (k >= 0)
|
||||
{
|
||||
if (k == 3) num[j++] = ' ';
|
||||
num[j++] = bits[k--] ? '1' : '0';
|
||||
}
|
||||
Item->item.pszText = num;
|
||||
break;
|
||||
}
|
||||
const char* formatString = ((t == 's') ? "%d" : (t == 'u') ? "%u" : (size == 'd' ? "%08X" : size == 'w' ? "%04X" : "%02X"));
|
||||
switch (size)
|
||||
{
|
||||
|
@ -1411,6 +1436,8 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
numberType = 1;
|
||||
else if(rswatches[watchIndex].Type == 'h')
|
||||
numberType = 2;
|
||||
else if (rswatches[watchIndex].Type == 'b')
|
||||
numberType = 3;
|
||||
|
||||
// Don't open cheat dialog
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ struct AddressWatcher
|
|||
char* comment = NULL; // NULL means no comment, non-NULL means allocated comment
|
||||
bool WrongEndian;
|
||||
char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator.
|
||||
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'S' = separator
|
||||
char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'b' = binary, 'S' = separator
|
||||
short Cheats; // how many bytes are affected by cheat
|
||||
};
|
||||
|
||||
|
|
|
@ -189,11 +189,13 @@ static void FCEU_CloseGame(void)
|
|||
}
|
||||
|
||||
if (GameInfo->type != GIT_NSF) {
|
||||
#ifdef WIN32
|
||||
if (disableAutoLSCheats == 2)
|
||||
FCEU_FlushGameCheats(0, 1);
|
||||
else if (disableAutoLSCheats == 1)
|
||||
AskSaveCheat();
|
||||
else if (disableAutoLSCheats == 0)
|
||||
#endif
|
||||
FCEU_FlushGameCheats(0, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue