[Project64] Change CDebugger to CDebuggerUI

This commit is contained in:
zilmar 2015-11-07 08:22:02 +11:00
parent d56236356a
commit 6585657d05
22 changed files with 1821 additions and 2275 deletions

View File

@ -0,0 +1 @@
#pragma once

View File

@ -3,7 +3,7 @@ class CDebugDialog :
public CDialogImpl < T > public CDialogImpl < T >
{ {
protected: protected:
CDebugger * m_Debugger; CDebuggerUI * m_Debugger;
HANDLE m_CreatedEvent; HANDLE m_CreatedEvent;
HANDLE m_DialogThread; HANDLE m_DialogThread;
@ -20,7 +20,7 @@ protected:
} }
public: public:
CDebugDialog (CDebugger * debugger) : CDebugDialog(CDebuggerUI * debugger) :
m_Debugger(debugger), m_Debugger(debugger),
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)), m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
m_DialogThread(NULL) m_DialogThread(NULL)

View File

@ -10,10 +10,9 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Debugger UI.h" #include "Debugger UI.h"
CDumpMemory::CDumpMemory(CDebugger * debugger) : CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
CDebugDialog<CDumpMemory>(debugger) CDebugDialog<CDumpMemory>(debugger)
{ {
} }
@ -124,207 +123,6 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
return FALSE; return FALSE;
} }
//#include "..\\..\\User Interface.h"
//#include "..\\..\\N64 System.h"
//#include <windows.h>
//
//DWORD CDumpMemory::m_StartAddress = 0x80000000;
//DWORD CDumpMemory::m_EndAddress = 0x803FFFF0;
//CDumpMemory::CDumpMemory(CMipsMemory * MMU) :
// m_Window(NULL), g_MMU(MMU)
//{
//}
//CDumpMemory::~CDumpMemory()
//{
//}
//void CDumpMemory::DisplayDump(HWND & hParent)
//{
// DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory),
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
//}
//DWORD CDumpMemory::AsciiToHex (const char * HexValue)
//{
// DWORD Count, Finish, Value = 0;
// Finish = strlen(HexValue);
// if (Finish > 8 )
// {
// Finish = 8;
// }
// for (Count = 0; Count < Finish; Count++
// {
// Value = (Value << 4);
// switch ( HexValue[Count] )
// {
// case '0': break;
// case '1': Value += 1; break;
// case '2': Value += 2; break;
// case '3': Value += 3; break;
// case '4': Value += 4; break;
// case '5': Value += 5; break;
// case '6': Value += 6; break;
// case '7': Value += 7; break;
// case '8': Value += 8; break;
// case '9': Value += 9; break;
// case 'A': Value += 10; break;
// case 'a': Value += 10; break;
// case 'B': Value += 11; break;
// case 'b': Value += 11; break;
// case 'C': Value += 12; break;
// case 'c': Value += 12; break;
// case 'D': Value += 13; break;
// case 'd': Value += 13; break;
// case 'E': Value += 14; break;
// case 'e': Value += 14; break;
// case 'F': Value += 15; break;
// case 'f': Value += 15; break;
// default:
// Value = (Value >> 4);
// Count = Finish;
// }
// }
// return Value;
//}
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
//{
// switch (uMsg)
// {
// case WM_INITDIALOG:
// {
// CDumpMemory * _this = (CDumpMemory *)lParam;
// SetProp(hDlg,"Class",_this);
// _this->m_Window = hDlg;
// SetDlgItemText(hDlg,IDC_E_START_ADDR,stdstr("0x%X",m_StartAddress).c_str());
// SetDlgItemText(hDlg,IDC_E_END_ADDR,stdstr("0x%X",m_EndAddress).c_str());
// SetDlgItemText(hDlg,IDC_E_ALT_PC,"0x80000000");
// HWND hFormatList = GetDlgItem(hDlg,IDC_FORMAT);
// int pos = SendMessage(hFormatList,CB_ADDSTRING,(WPARAM)0,(LPARAM)"TEXT - Disassembly + PC");
// SendMessage(hFormatList,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)DisassemblyWithPC);
// SendMessage(hFormatList,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
// }
// break;
// case WM_COMMAND:
// switch (LOWORD(wParam))
// {
// case IDC_E_START_ADDR:
// case IDC_E_END_ADDR:
// case IDC_E_ALT_PC:
// if (HIWORD(wParam) == EN_UPDATE)
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// TCHAR szTmp[20], szTmp2[20];
// DWORD Value;
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// //if (Value > Stop)
// //{
// // Value = Stop;
// //}
// //if (Value < Start)
// //{
// // Value = Start;
// //}
// sprintf(szTmp2,"0x%X",Value);
// if (strcmp(szTmp,szTmp2) != 0)
// {
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
// if (_this->SelStop == 0)
// {
// _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop;
// }
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
// }
// else
// {
// WORD NewSelStart, NewSelStop;
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
// if (NewSelStart != 0)
// {
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
// }
// }
// }
// break;
// case IDC_BTN_CHOOSE_FILE:
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// OPENFILENAME openfilename;
// char FileName[_MAX_PATH],Directory[_MAX_PATH];
// memset(&FileName, 0, sizeof(FileName));
// memset(&openfilename, 0, sizeof(openfilename));
// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str());
// openfilename.lStructSize = sizeof( openfilename );
// openfilename.hwndOwner = hDlg;
// openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
// openfilename.lpstrFile = FileName;
// openfilename.lpstrInitialDir = Directory;
// openfilename.nMaxFile = MAX_PATH;
// openfilename.Flags = OFN_HIDEREADONLY;
// if (GetOpenFileName (&openfilename))
// {
// char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
// _splitpath( FileName, drive, dir, fname, ext );
// if (strlen(ext) == 0)
// {
// strcat(FileName,".txt");
// }
// SetDlgItemText(hDlg,IDC_FILENAME,FileName);
// }
// }
// break;
// case IDCANCEL:
// RemoveProp(hDlg,"Class");
// EndDialog(hDlg,0);
// break;
// case IDOK:
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// TCHAR szTmp[20], FileName[MAX_PATH];
// int CurrentFormatSel = SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETCURSEL,0,0);
// DumpFormat Format = (DumpFormat)SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETITEMDATA,CurrentFormatSel,0);
// GetDlgItemText(hDlg,IDC_E_START_ADDR,szTmp,sizeof(szTmp));
// DWORD StartPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_E_END_ADDR,szTmp,sizeof(szTmp));
// DWORD EndPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_E_ALT_PC,szTmp,sizeof(szTmp));
// DWORD DumpPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_FILENAME,FileName,sizeof(FileName));
// if (strlen(FileName) == 0)
// {
// g_Notify->DisplayError(L"Please Choose target file");
// SetFocus(GetDlgItem(hDlg,IDC_FILENAME));
// return false;
// }
// if (SendDlgItemMessage(hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
// {
// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER;
// }
// //disable buttons
// EnableWindow(GetDlgItem(hDlg,IDC_E_START_ADDR),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_E_END_ADDR),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_E_ALT_PC),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_USE_ALT_PC),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_FILENAME),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_BTN_CHOOSE_FILE),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_FORMAT),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDOK),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDCANCEL),FALSE);
// if (!_this->DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
// {
// //enable buttons
// return false;
// }
// }
// RemoveProp(hDlg,"Class");
// EndDialog(hDlg,0);
// break;
// }
// break;
// default:
// return false;
// }
// return true;
//}
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/) bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
{ {
switch (Format) switch (Format)
@ -357,242 +155,3 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
} }
return false; return false;
} }
//
//CDumpMemory::CDumpMemory(CMipsMemory * MMU) :
// m_Window(NULL), g_MMU(MMU)
//{
//}
//
//CDumpMemory::~CDumpMemory()
//{
//}
//
//void CDumpMemory::DisplayDump(HWND & hParent)
//{
// DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory),
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
//}
//
//DWORD CDumpMemory::AsciiToHex (const char * HexValue)
//{
// DWORD Count, Finish, Value = 0;
//
// Finish = strlen(HexValue);
// if (Finish > 8 )
// {
// Finish = 8;
// }
//
// for (Count = 0; Count < Finish; Count++)
// {
// Value = (Value << 4);
// switch ( HexValue[Count] )
// {
// case '0': break;
// case '1': Value += 1; break;
// case '2': Value += 2; break;
// case '3': Value += 3; break;
// case '4': Value += 4; break;
// case '5': Value += 5; break;
// case '6': Value += 6; break;
// case '7': Value += 7; break;
// case '8': Value += 8; break;
// case '9': Value += 9; break;
// case 'A': Value += 10; break;
// case 'a': Value += 10; break;
// case 'B': Value += 11; break;
// case 'b': Value += 11; break;
// case 'C': Value += 12; break;
// case 'c': Value += 12; break;
// case 'D': Value += 13; break;
// case 'd': Value += 13; break;
// case 'E': Value += 14; break;
// case 'e': Value += 14; break;
// case 'F': Value += 15; break;
// case 'f': Value += 15; break;
// default:
// Value = (Value >> 4);
// Count = Finish;
// }
// }
// return Value;
//}
//
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
//{
// switch (uMsg)
// {
// case WM_INITDIALOG:
// {
// CDumpMemory * _this = (CDumpMemory *)lParam;
// SetProp(hDlg,"Class",_this);
// _this->m_Window = hDlg;
// SetDlgItemText(hDlg,IDC_E_START_ADDR,stdstr("0x%X",m_StartAddress).c_str());
// SetDlgItemText(hDlg,IDC_E_END_ADDR,stdstr("0x%X",m_EndAddress).c_str());
// SetDlgItemText(hDlg,IDC_E_ALT_PC,"0x80000000");
//
// HWND hFormatList = GetDlgItem(hDlg,IDC_FORMAT);
// int pos = SendMessage(hFormatList,CB_ADDSTRING,(WPARAM)0,(LPARAM)"TEXT - Disassembly + PC");
// SendMessage(hFormatList,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)DisassemblyWithPC);
// SendMessage(hFormatList,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
//
// }
// break;
// case WM_COMMAND:
// switch (LOWORD(wParam))
// {
// case IDC_E_START_ADDR:
// case IDC_E_END_ADDR:
// case IDC_E_ALT_PC:
// if (HIWORD(wParam) == EN_UPDATE)
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
//
// TCHAR szTmp[20], szTmp2[20];
// DWORD Value;
//
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// //if (Value > Stop)
// //{
// // Value = Stop;
// //}
// //if (Value < Start)
// //{
// // Value = Start;
// //}
// sprintf(szTmp2,"0x%X",Value);
// if (strcmp(szTmp,szTmp2) != 0)
// {
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
// if (_this->SelStop == 0) { _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop; }
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
// }
// else
// {
// WORD NewSelStart, NewSelStop;
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
// if (NewSelStart != 0)
// {
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
// }
// }
// }
// break;
// case IDC_BTN_CHOOSE_FILE:
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
//
// OPENFILENAME openfilename;
// char FileName[_MAX_PATH],Directory[_MAX_PATH];
//
// memset(&FileName, 0, sizeof(FileName));
// memset(&openfilename, 0, sizeof(openfilename));
//
// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str());
//
// openfilename.lStructSize = sizeof( openfilename );
// openfilename.hwndOwner = hDlg;
// openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
// openfilename.lpstrFile = FileName;
// openfilename.lpstrInitialDir = Directory;
// openfilename.nMaxFile = MAX_PATH;
// openfilename.Flags = OFN_HIDEREADONLY;
//
// if (GetOpenFileName (&openfilename))
// {
// char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
//
// _splitpath( FileName, drive, dir, fname, ext );
// if (strlen(ext) == 0)
// {
// strcat(FileName,".txt");
// }
// SetDlgItemText(hDlg,IDC_FILENAME,FileName);
// }
// }
// break;
// case IDCANCEL:
// RemoveProp(hDlg,"Class");
// EndDialog(hDlg,0);
// break;
// case IDOK:
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// TCHAR szTmp[20], FileName[MAX_PATH];
//
// int CurrentFormatSel = SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETCURSEL,0,0);
// DumpFormat Format = (DumpFormat)SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETITEMDATA,CurrentFormatSel,0);
//
// GetDlgItemText(hDlg,IDC_E_START_ADDR,szTmp,sizeof(szTmp));
// DWORD StartPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_E_END_ADDR,szTmp,sizeof(szTmp));
// DWORD EndPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_E_ALT_PC,szTmp,sizeof(szTmp));
// DWORD DumpPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// GetDlgItemText(hDlg,IDC_FILENAME,FileName,sizeof(FileName));
//
// if (strlen(FileName) == 0)
// {
// g_Notify->DisplayError(L"Please Choose target file");
// SetFocus(GetDlgItem(hDlg,IDC_FILENAME));
// return false;
// }
//
// if (SendDlgItemMessage(hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
// {
// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER;
// }
// //disable buttons
// EnableWindow(GetDlgItem(hDlg,IDC_E_START_ADDR),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_E_END_ADDR),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_E_ALT_PC),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_USE_ALT_PC),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_FILENAME),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_BTN_CHOOSE_FILE),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDC_FORMAT),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDOK),FALSE);
// EnableWindow(GetDlgItem(hDlg,IDCANCEL),FALSE);
// if (!_this->DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
// {
// //enable buttons
// return false;
// }
// }
// RemoveProp(hDlg,"Class");
// EndDialog(hDlg,0);
// break;
// }
// break;
// default:
// return false;
// }
// return true;
//}
//
//bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC )
//{
// switch (Format)
// {
// case DisassemblyWithPC:
// {
// CLog LogFile(FileName);
// if (!LogFile.IsOpen())
// {
// g_Notify->DisplayError(L"Failed to open\n%s",FileName);
// return false;
// }
//
// for (COpcode OpCode(g_MMU,StartPC); OpCode.PC() < EndPC; OpCode.Next())
// {
// LogFile.Log("%X: %s",OpCode.PC(),OpCode.Name().c_str());
// }
// m_StartAddress = StartPC;
// m_EndAddress = EndPC;
// return true;
// }
// break;
// }
// return false;
//}
#endif

View File

@ -16,7 +16,7 @@ class CDumpMemory :
public: public:
enum { IDD = IDD_Cheats_DumpMemory }; enum { IDD = IDD_Cheats_DumpMemory };
CDumpMemory(CDebugger * debugger); CDumpMemory(CDebuggerUI * debugger);
virtual ~CDumpMemory(void); virtual ~CDumpMemory(void);
private: private:

View File

@ -10,10 +10,9 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Debugger UI.h" #include "Debugger UI.h"
CDebugMemorySearch::CDebugMemorySearch(CDebugger * debugger) : CDebugMemorySearch::CDebugMemorySearch(CDebuggerUI * debugger) :
CDebugDialog<CDebugMemorySearch>(debugger), CDebugDialog<CDebugMemorySearch>(debugger),
m_MemoryState(NULL), m_MemoryState(NULL),
m_MemoryStateSize(0) m_MemoryStateSize(0)
@ -598,7 +597,7 @@ bool CDebugMemorySearch::SearchForChanges(SearchMemChangeState SearchType, Memor
if (SearchType == SearchChangeState_Reset) if (SearchType == SearchChangeState_Reset)
{ {
Notify().BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__, __LINE__);
} }
if (Size == _32Bit) { StartAddress = ((StartAddress + 3) & ~3); } if (Size == _32Bit) { StartAddress = ((StartAddress + 3) & ~3); }
if (Size == _16Bit) { StartAddress = ((StartAddress + 1) & ~1); } if (Size == _16Bit) { StartAddress = ((StartAddress + 1) & ~1); }
@ -789,4 +788,3 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
} }
return false; return false;
} }
#endif

View File

@ -16,7 +16,7 @@ class CDebugMemorySearch :
public: public:
enum { IDD = IDD_Debugger_Search }; enum { IDD = IDD_Debugger_Search };
CDebugMemorySearch(CDebugger * debugger); CDebugMemorySearch(CDebuggerUI * debugger);
virtual ~CDebugMemorySearch(void); virtual ~CDebugMemorySearch(void);
private: private:

View File

@ -10,10 +10,9 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Debugger UI.h" #include "Debugger UI.h"
CDebugTlb::CDebugTlb(CDebugger * debugger) : CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
CDebugDialog<CDebugTlb>(debugger) CDebugDialog<CDebugTlb>(debugger)
{ {
} }
@ -287,4 +286,3 @@ void CDebugTlb::RefreshTLBWindow (void)
} }
} }
} }
#endif

View File

@ -13,7 +13,6 @@
class CDebugTlb : class CDebugTlb :
public CDebugDialog < CDebugTlb > public CDebugDialog < CDebugTlb >
{ {
BEGIN_MSG_MAP_EX(CDebugTlb) BEGIN_MSG_MAP_EX(CDebugTlb)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked) COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
@ -25,7 +24,7 @@ class CDebugTlb :
public: public:
enum { IDD = IDD_Debugger_TLB }; enum { IDD = IDD_Debugger_TLB };
CDebugTlb(CDebugger * debugger); CDebugTlb(CDebuggerUI * debugger);
virtual ~CDebugTlb(void); virtual ~CDebugTlb(void);
void RefreshTLBWindow(void); void RefreshTLBWindow(void);

View File

@ -10,10 +10,9 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Debugger UI.h" #include "Debugger UI.h"
CDebugMemoryView::CDebugMemoryView(CDebugger * debugger) : CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
CDebugDialog<CDebugMemoryView>(debugger), CDebugDialog<CDebugMemoryView>(debugger),
m_MemoryList(NULL) m_MemoryList(NULL)
{ {
@ -430,7 +429,6 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
} }
} }
WritePos = 4 - Offset; WritePos = 4 - Offset;
} }
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4) for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
@ -472,4 +470,3 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
Insert_MemoryLineDump(count); Insert_MemoryLineDump(count);
} }
} }
#endif

View File

@ -13,7 +13,15 @@
class CDebugMemoryView : class CDebugMemoryView :
public CDebugDialog < CDebugMemoryView > public CDebugDialog < CDebugMemoryView >
{ {
public:
enum { IDD = IDD_Debugger_Memory };
CDebugMemoryView(CDebuggerUI * debugger);
virtual ~CDebugMemoryView(void);
void ShowAddress(DWORD Address, bool VAddr);
private:
BEGIN_MSG_MAP_EX(CDebugMemoryView) BEGIN_MSG_MAP_EX(CDebugMemoryView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked) COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
@ -47,12 +55,4 @@ class CDebugMemoryView :
bool m_CompareVAddrr; bool m_CompareVAddrr;
BYTE m_CompareData[MemoryToDisplay]; BYTE m_CompareData[MemoryToDisplay];
bool m_CompareValid[MemoryToDisplay]; bool m_CompareValid[MemoryToDisplay];
public:
enum { IDD = IDD_Debugger_Memory };
CDebugMemoryView(CDebugger * debugger);
virtual ~CDebugMemoryView(void);
void ShowAddress (DWORD Address, bool VAddr);
}; };

View File

@ -1,41 +1,4 @@
////#define _WIN32_WINNT 0x0500 #pragma once
//#include <atlbase.h>
//#include <wtl/atlapp.h>
////#include <atlbase.h>
////#include <atlapp.h>
//class CPj64Module :
// public CAppModule
//{
//public:
// CPj64Module(void)
// {
// Init(NULL, GetModuleHandle(NULL));
// }
// virtual ~CPj64Module(void)
// {
// Term();
// }
//};
//
//
//extern CPj64Module _Module;
//
//#define _WTL_NO_CSTRING
//
//#include <atlwin.h>
//#include <wtl/atlmisc.h>
//#include <wtl/atlcrack.h>
//
//#include <wtl/atlframe.h>
//#include <wtl/atlctrls.h>
//#include <wtl/atldlgs.h>
//
//#include "../../Support.h"
//#include "Control/numberctrl.h"
//#include "Control/ClistCtrl/ListCtrl.h"
#include "../../WTL App.h" #include "../../WTL App.h"
#include "../../N64 System.h" #include "../../N64 System.h"

View File

@ -9,26 +9,36 @@
* * * *
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#ifdef WINDOWS_UI
#include "Debugger UI.h" #include "Debugger UI.h"
CPj64Module _Module; CPj64Module _Module;
CDebugger::CDebugger () : CDebuggerUI::CDebuggerUI () :
m_MemoryDump(NULL), m_MemoryDump(NULL),
m_MemoryView(NULL), m_MemoryView(NULL),
m_MemorySearch(NULL), m_MemorySearch(NULL),
m_DebugTLB(NULL) m_DebugTLB(NULL)
{ {
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
g_Debugger = this;
} }
CDebugger::~CDebugger (void) CDebuggerUI::~CDebuggerUI (void)
{ {
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
Debug_Reset(); Debug_Reset();
} }
void CDebugger::Debug_Reset ( void ) void CDebuggerUI::GameReset ( CDebuggerUI * _this )
{
if (!g_Settings->LoadBool(GameRunning_InReset))
{
return;
}
_this->Debug_Reset();
}
void CDebuggerUI::Debug_Reset ( void )
{ {
if (m_MemoryDump) if (m_MemoryDump)
{ {
@ -56,7 +66,7 @@ void CDebugger::Debug_Reset ( void )
} }
} }
void CDebugger::Debug_ShowMemoryDump() void CDebuggerUI::Debug_ShowMemoryDump()
{ {
if (g_MMU == NULL) if (g_MMU == NULL)
{ {
@ -72,7 +82,7 @@ void CDebugger::Debug_ShowMemoryDump()
} }
} }
void CDebugger::Debug_ShowMemoryWindow ( void ) void CDebuggerUI::Debug_ShowMemoryWindow ( void )
{ {
if (g_MMU == NULL) if (g_MMU == NULL)
{ {
@ -88,7 +98,7 @@ void CDebugger::Debug_ShowMemoryWindow ( void )
} }
} }
void CDebugger::Debug_ShowMemoryLocation ( DWORD Address, bool VAddr ) void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
{ {
Debug_ShowMemoryWindow(); Debug_ShowMemoryWindow();
if (m_MemoryView) if (m_MemoryView)
@ -97,7 +107,7 @@ void CDebugger::Debug_ShowMemoryLocation ( DWORD Address, bool VAddr )
} }
} }
void CDebugger::Debug_ShowTLBWindow (void) void CDebuggerUI::Debug_ShowTLBWindow (void)
{ {
if (g_MMU == NULL) if (g_MMU == NULL)
{ {
@ -113,7 +123,7 @@ void CDebugger::Debug_ShowTLBWindow (void)
} }
} }
void CDebugger::Debug_RefreshTLBWindow(void) void CDebuggerUI::Debug_RefreshTLBWindow(void)
{ {
if (m_DebugTLB) if (m_DebugTLB)
{ {
@ -121,7 +131,7 @@ void CDebugger::Debug_RefreshTLBWindow(void)
} }
} }
void CDebugger::Debug_ShowMemorySearch() void CDebuggerUI::Debug_ShowMemorySearch()
{ {
if (m_MemorySearch == NULL) if (m_MemorySearch == NULL)
{ {
@ -132,4 +142,8 @@ void CDebugger::Debug_ShowMemorySearch()
m_MemorySearch->ShowWindow(); m_MemorySearch->ShowWindow();
} }
} }
#endif
void CDebuggerUI::TLBChanged()
{
Debug_RefreshTLBWindow();
}

View File

@ -13,8 +13,15 @@
class CDumpMemory; class CDumpMemory;
class CDebugMemoryView; class CDebugMemoryView;
class CDebugMemorySearch; class CDebugMemorySearch;
class CDebugTlb;
class CDebugger __interface CDebugger
{
virtual void TLBChanged ( void ) = 0;
};
class CDebuggerUI :
public CDebugger
{ {
CDumpMemory * m_MemoryDump; CDumpMemory * m_MemoryDump;
CDebugMemoryView * m_MemoryView; CDebugMemoryView * m_MemoryView;
@ -22,16 +29,19 @@ class CDebugger
CDebugTlb * m_DebugTLB; CDebugTlb * m_DebugTLB;
protected: protected:
CDebugger(); CDebuggerUI();
virtual ~CDebugger(); virtual ~CDebuggerUI();
void TLBChanged ( void );
public: public:
void Debug_Reset ( void ); void Debug_Reset ( void );
void Debug_ShowMemoryDump ( void ); void Debug_ShowMemoryDump ( void );
void Debug_ShowMemoryWindow ( void ); void Debug_ShowMemoryWindow ( void );
void Debug_ShowMemoryLocation ( DWORD Address, bool VAddr ); void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
void Debug_ShowMemorySearch ( void ); void Debug_ShowMemorySearch ( void );
void Debug_ShowTLBWindow ( void ); void Debug_ShowTLBWindow ( void );
void Debug_RefreshTLBWindow ( void ); void Debug_RefreshTLBWindow ( void );
static void GameReset ( CDebuggerUI * _this );
}; };

View File

@ -567,14 +567,10 @@ void CN64System::PluginReset()
void CN64System::Reset (bool bInitReg, bool ClearMenory) void CN64System::Reset (bool bInitReg, bool ClearMenory)
{ {
g_Settings->SaveBool(GameRunning_InReset,true);
RefreshGameSettings(); RefreshGameSettings();
m_Audio.Reset(); m_Audio.Reset();
m_MMU_VM.Reset(ClearMenory); m_MMU_VM.Reset(ClearMenory);
#if defined(WINDOWS_UI)
Debug_Reset();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
Mempak::Close(); Mempak::Close();
m_CyclesToSkip = 0; m_CyclesToSkip = 0;
@ -617,6 +613,7 @@ void CN64System::Reset (bool bInitReg, bool ClearMenory)
{ {
m_SyncCPU->Reset(bInitReg,ClearMenory); m_SyncCPU->Reset(bInitReg,ClearMenory);
} }
g_Settings->SaveBool(GameRunning_InReset,true);
} }
bool CN64System::SetActiveSystem( bool bActive ) bool CN64System::SetActiveSystem( bool bActive )
@ -2098,9 +2095,8 @@ void CN64System::TLB_Unmaped ( DWORD VAddr, DWORD Len )
void CN64System::TLB_Changed() void CN64System::TLB_Changed()
{ {
#if defined(WINDOWS_UI) if (g_Debugger)
Debug_RefreshTLBWindow(); {
#else g_Debugger->TLBChanged();
g_Notify -> BreakPoint(__FILEW__, __LINE__); }
#endif
} }

View File

@ -16,21 +16,17 @@ typedef std::map<DWORD, DWORD> FUNC_CALLS;
class CPlugins; class CPlugins;
class CRSP_Plugin; class CRSP_Plugin;
class CRecompiler;
//#define TEST_SP_TRACKING //track the SP to make sure all ops pick it up fine //#define TEST_SP_TRACKING //track the SP to make sure all ops pick it up fine
class CN64System : class CN64System :
private CMipsMemory_CallBack, public CMipsMemory_CallBack,
private CTLB_CB, public CTLB_CB,
private CSystemEvents, private CSystemEvents,
protected CN64SystemSettings, protected CN64SystemSettings,
public CGameSettings, public CGameSettings,
#if defined(WINDOWS_UI)
protected CDebugSettings,
public CDebugger
#else
protected CDebugSettings protected CDebugSettings
#endif
{ {
public: public:
CN64System(CPlugins * Plugins, bool SavesReadOnly); CN64System(CPlugins * Plugins, bool SavesReadOnly);

View File

@ -26,6 +26,7 @@ CTransVaddr * g_TransVaddr = NULL;
CSystemEvents * g_SystemEvents = NULL; CSystemEvents * g_SystemEvents = NULL;
DWORD * g_TLBLoadAddress = NULL; DWORD * g_TLBLoadAddress = NULL;
DWORD * g_TLBStoreAddress = NULL; DWORD * g_TLBStoreAddress = NULL;
CDebugger * g_Debugger = NULL;
int * g_NextTimer; int * g_NextTimer;

View File

@ -29,3 +29,6 @@ extern CSystemEvents * g_SystemEvents;
extern int * g_NextTimer; extern int * g_NextTimer;
extern DWORD * g_TLBLoadAddress; extern DWORD * g_TLBLoadAddress;
extern DWORD * g_TLBStoreAddress; extern DWORD * g_TLBStoreAddress;
__interface CDebugger;
extern CDebugger * g_Debugger;

View File

@ -1064,6 +1064,10 @@
RelativePath="N64 System\Cheat Class.h" RelativePath="N64 System\Cheat Class.h"
> >
</File> </File>
<File
RelativePath=".\Debugger.h"
>
</File>
<File <File
RelativePath="N64 System\N64 Class.h" RelativePath="N64 System\N64 Class.h"
> >

View File

@ -10,9 +10,13 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#define MaxPluginSetting 65535 enum
{
MaxPluginSetting = 65535
};
enum SettingID { enum SettingID
{
//Default values //Default values
Default_None, Default_None,
Default_Constant, Default_Constant,
@ -154,6 +158,7 @@ enum SettingID {
GameRunning_InstantSaveFile, GameRunning_InstantSaveFile,
GameRunning_LimitFPS, GameRunning_LimitFPS,
GameRunning_ScreenHertz, GameRunning_ScreenHertz,
GameRunning_InReset,
//User Interface //User Interface
UserInterface_BasicMode, UserInterface_BasicMode,

View File

@ -291,6 +291,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString("")); AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString(""));
AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true)); AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true));
AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60)); AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60));
AddHandler(GameRunning_InReset, new CSettingTypeTempBool(false));
AddHandler(File_RecentGameFileCount, new CSettingTypeApplication("","Remembered Rom Files",(uint32_t)10)); AddHandler(File_RecentGameFileCount, new CSettingTypeApplication("","Remembered Rom Files",(uint32_t)10));
AddHandler(File_RecentGameFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None)); AddHandler(File_RecentGameFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None));

View File

@ -10,15 +10,17 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <Project64\N64 System\Debugger\debugger.h>
class CGfxPlugin; //Plugin that controls the rendering class CGfxPlugin; //Plugin that controls the rendering
class CAudioPlugin; //Plugin for audio, need the hwnd class CAudioPlugin; //Plugin for audio, need the hwnd
class CControl_Plugin; //Controller needs hwnd to see if it is the focused window class CControl_Plugin; //Controller needs hwnd to see if it is the focused window
class CBaseMenu; //Menu for the gui class CBaseMenu; //Menu for the gui
class CN64System; class CN64System;
class CNotification;
class CriticalSection; class CriticalSection;
enum { enum
{
WM_HIDE_CUROSR = WM_USER + 10, WM_HIDE_CUROSR = WM_USER + 10,
WM_MAKE_FOCUS = WM_USER + 17, WM_MAKE_FOCUS = WM_USER + 17,
WM_RESET_PLUGIN = WM_USER + 18, WM_RESET_PLUGIN = WM_USER + 18,
@ -27,6 +29,7 @@ enum {
class CMainGui : class CMainGui :
public CRomBrowser, public CRomBrowser,
public CDebuggerUI,
private CGuiSettings private CGuiSettings
{ {
enum { StatusBarID = 400 }; enum { StatusBarID = 400 };

View File

@ -458,12 +458,10 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUGGER_GENERATELOG: case ID_DEBUGGER_GENERATELOG:
g_Settings->SaveBool(Debugger_GenerateDebugLog,!g_Settings->LoadBool(Debugger_GenerateDebugLog)); g_Settings->SaveBool(Debugger_GenerateDebugLog,!g_Settings->LoadBool(Debugger_GenerateDebugLog));
break; break;
case ID_DEBUGGER_DUMPMEMORY: case ID_DEBUGGER_DUMPMEMORY: _Gui->Debug_ShowMemoryDump(); break;
g_BaseSystem->Debug_ShowMemoryDump(); case ID_DEBUGGER_SEARCHMEMORY: _Gui->Debug_ShowMemorySearch(); break;
break; case ID_DEBUGGER_MEMORY: _Gui->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_SEARCHMEMORY: g_BaseSystem->Debug_ShowMemorySearch(); break; case ID_DEBUGGER_TLBENTRIES: _Gui->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_MEMORY: g_BaseSystem->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: g_BaseSystem->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_INTERRUPT_SP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break; case ID_DEBUGGER_INTERRUPT_SP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
case ID_DEBUGGER_INTERRUPT_SI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break; case ID_DEBUGGER_INTERRUPT_SI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
case ID_DEBUGGER_INTERRUPT_AI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break; case ID_DEBUGGER_INTERRUPT_AI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;