Fixed bug 3005909, which involved pausing emulation outside of the debugger, then trying to use the debugger commands, and having the CPU registers become corrupted.

This commit is contained in:
ugetab 2010-05-23 15:52:42 +00:00
parent 3d244249d6
commit b05cb472da
1 changed files with 11 additions and 5 deletions

View File

@ -61,6 +61,7 @@ int DbgSizeX=-1,DbgSizeY=-1;
int WP_edit=-1;
int ChangeWait=0,ChangeWait2=0;
uint8 debugger_open=0;
bool DebuggerWasUpdated = false;
HWND hDebug;
static HMENU hDebugcontext; //Handle to context menu
static HMENU hDebugcontextsub; //Handle to context sub menu
@ -514,11 +515,13 @@ int GetEditStack(HWND hwndDlg) {
*/
void UpdateRegs(HWND hwndDlg) {
if (DebuggerWasUpdated) {
X.A = GetEditHex(hwndDlg,IDC_DEBUGGER_VAL_A);
X.X = GetEditHex(hwndDlg,IDC_DEBUGGER_VAL_X);
X.Y = GetEditHex(hwndDlg,IDC_DEBUGGER_VAL_Y);
X.PC = GetEditHex(hwndDlg,IDC_DEBUGGER_VAL_PC);
}
}
///indicates whether we're under the control of the debugger
bool inDebugger = false;
@ -617,6 +620,8 @@ void UpdateDebugger()
if (tmp & I_FLAG) CheckDlgButton(hDebug, IDC_DEBUGGER_FLAG_I, BST_CHECKED);
if (tmp & Z_FLAG) CheckDlgButton(hDebug, IDC_DEBUGGER_FLAG_Z, BST_CHECKED);
if (tmp & C_FLAG) CheckDlgButton(hDebug, IDC_DEBUGGER_FLAG_C, BST_CHECKED);
DebuggerWasUpdated = true;
}
char *BreakToText(unsigned int num) {
@ -1342,6 +1347,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
if (FCEUI_EmulationPaused()) {
UpdateRegs(hwndDlg);
FCEUI_ToggleEmulationPause();
DebuggerWasUpdated = false;
}
break;
case IDC_DEBUGGER_STEP_IN: