[Project64] clean up debugger code

This commit is contained in:
zilmar 2017-09-13 20:36:03 +10:00
parent b645ef908f
commit 7bb70c2a49
21 changed files with 1316 additions and 1326 deletions

View File

@ -2,31 +2,29 @@
#include <stdint.h>
typedef void(*SYNTAX)(uint32_t* opcode);
typedef struct {
const char* name;
uint32_t val;
uint32_t(*base)(uint32_t val); // value shift
SYNTAX* syntax; // arguments
const char* name;
uint32_t val;
uint32_t(*base)(uint32_t val); // value shift
SYNTAX* syntax; // arguments
} INSTRUCTION;
typedef struct {
const char* name;
uint32_t val;
const char* name;
uint32_t val;
} REGISTER;
enum ParseError
{
ERR_NONE,
ERR_EXPECTED_REG,
ERR_INVALID_REG,
ERR_EXPECTED_VAL
ERR_NONE,
ERR_EXPECTED_REG,
ERR_INVALID_REG,
ERR_EXPECTED_VAL
};
class CAssembler {
public:
static bool AssembleLine(char* line, uint32_t* opcode, uint32_t address = 0x00000000);
static bool AssembleLine(char* line, uint32_t* opcode, uint32_t address = 0x00000000);
};

View File

@ -15,129 +15,128 @@
class CBreakpoints {
private:
public:
typedef struct {
uint32_t address;
bool bTemporary;
} BREAKPOINT;
typedef struct {
uint32_t address;
bool bTemporary;
} BREAKPOINT;
enum BPSTATE {
BP_NOT_SET = FALSE,
BP_SET,
BP_SET_TEMP
};
enum BPSTATE {
BP_NOT_SET = FALSE,
BP_SET,
BP_SET_TEMP
};
CBreakpoints();
CBreakpoints();
BOOL m_Debugging;
BOOL m_Skipping;
BOOL m_Debugging;
BOOL m_Skipping;
std::vector<BREAKPOINT> m_RBP;
std::vector<BREAKPOINT> m_WBP;
std::vector<BREAKPOINT> m_EBP;
std::vector<BREAKPOINT> m_RBP;
std::vector<BREAKPOINT> m_WBP;
std::vector<BREAKPOINT> m_EBP;
int m_nRBP;
int m_nWBP;
int m_nEBP;
int m_nRBP;
int m_nWBP;
int m_nEBP;
void Pause();
void Resume();
void Skip();
void Pause();
void Resume();
void Skip();
BOOL isDebugging();
void KeepDebugging();
void StopDebugging();
inline BOOL isSkipping()
{
BOOL ret = m_Skipping;
m_Skipping = FALSE;
return ret;
}
BOOL isDebugging();
void KeepDebugging();
void StopDebugging();
inline BOOL isSkipping()
{
BOOL ret = m_Skipping;
m_Skipping = FALSE;
return ret;
}
bool RBPAdd(uint32_t address, bool bTemporary = false);
void RBPRemove(uint32_t address);
void RBPToggle(uint32_t address, bool bTemporary = false);
void RBPClear();
bool RBPAdd(uint32_t address, bool bTemporary = false);
void RBPRemove(uint32_t address);
void RBPToggle(uint32_t address, bool bTemporary = false);
void RBPClear();
bool WBPAdd(uint32_t address, bool bTemporary = false);
void WBPRemove(uint32_t address);
void WBPToggle(uint32_t address, bool bTemporary = false);
void WBPClear();
bool WBPAdd(uint32_t address, bool bTemporary = false);
void WBPRemove(uint32_t address);
void WBPToggle(uint32_t address, bool bTemporary = false);
void WBPClear();
bool EBPAdd(uint32_t address, bool bTemporary = false);
void EBPRemove(uint32_t address);
void EBPToggle(uint32_t address, bool bTemporary = false);
void EBPClear();
void BPClear();
bool EBPAdd(uint32_t address, bool bTemporary = false);
void EBPRemove(uint32_t address);
void EBPToggle(uint32_t address, bool bTemporary = false);
void EBPClear();
// inlines
void BPClear();
inline BPSTATE RBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nRBP; i++)
{
if (m_RBP[i].address != address)
{
continue;
}
// inlines
if (m_RBP[i].bTemporary)
{
if (bRemoveTemp)
{
RBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
inline BPSTATE RBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nRBP; i++)
{
if (m_RBP[i].address != address)
{
continue;
}
inline BPSTATE WBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nWBP; i++)
{
if (m_WBP[i].address != address)
{
continue;
}
if (m_RBP[i].bTemporary)
{
if (bRemoveTemp)
{
RBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
if (m_WBP[i].bTemporary)
{
if (bRemoveTemp)
{
WBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
inline BPSTATE WBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nWBP; i++)
{
if (m_WBP[i].address != address)
{
continue;
}
inline BPSTATE EBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nEBP; i++)
{
if (m_EBP[i].address != address)
{
continue;
}
if (m_WBP[i].bTemporary)
{
if (bRemoveTemp)
{
WBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
if (m_EBP[i].bTemporary)
{
if (bRemoveTemp)
{
EBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
inline BPSTATE EBPExists(uint32_t address, bool bRemoveTemp = false)
{
for (int i = 0; i < m_nEBP; i++)
{
if (m_EBP[i].address != address)
{
continue;
}
if (m_EBP[i].bTemporary)
{
if (bRemoveTemp)
{
EBPRemove(address);
}
return BP_SET_TEMP;
}
return BP_SET;
}
return BP_NOT_SET;
}
};

View File

@ -14,23 +14,23 @@
struct DMALOGENTRY
{
uint32_t romAddr;
uint32_t ramAddr;
uint32_t length;
uint32_t romAddr;
uint32_t ramAddr;
uint32_t length;
};
class CDMALog
{
private:
vector<DMALOGENTRY> m_Log;
vector<DMALOGENTRY> m_Log;
public:
void AddEntry(uint32_t romAddr, uint32_t ramAddr, uint32_t length);
void ClearEntries();
size_t GetNumEntries();
DMALOGENTRY* GetEntryByIndex(uint32_t index);
DMALOGENTRY* GetEntryByRamAddress(uint32_t ramAddr);
DMALOGENTRY* GetEntryByRamAddress(uint32_t ramAddr, uint32_t* lpRomAddr, uint32_t* lpOffset);
DMALOGENTRY* GetEntryByRomAddress(uint32_t romAddr);
DMALOGENTRY* GetEntryByRomAddress(uint32_t romAddr, uint32_t* lpRamAddr, uint32_t* lpOffset);
void AddEntry(uint32_t romAddr, uint32_t ramAddr, uint32_t length);
void ClearEntries();
size_t GetNumEntries();
DMALOGENTRY* GetEntryByIndex(uint32_t index);
DMALOGENTRY* GetEntryByRamAddress(uint32_t ramAddr);
DMALOGENTRY* GetEntryByRamAddress(uint32_t ramAddr, uint32_t* lpRomAddr, uint32_t* lpOffset);
DMALOGENTRY* GetEntryByRomAddress(uint32_t romAddr);
DMALOGENTRY* GetEntryByRomAddress(uint32_t romAddr, uint32_t* lpRamAddr, uint32_t* lpOffset);
};

View File

@ -16,32 +16,32 @@
class CAddBreakpointDlg : public CDialogImpl<CAddBreakpointDlg>
{
public:
enum { IDD = IDD_Debugger_AddBreakpoint };
enum { IDD = IDD_Debugger_AddBreakpoint };
INT_PTR CAddBreakpointDlg::DoModal(CDebuggerUI* debugger)
{
m_Debugger = debugger;
return CDialogImpl<CAddBreakpointDlg>::DoModal();
}
INT_PTR CAddBreakpointDlg::DoModal(CDebuggerUI* debugger)
{
m_Debugger = debugger;
return CDialogImpl<CAddBreakpointDlg>::DoModal();
}
private:
CDebuggerUI* m_Debugger;
CDebuggerUI* m_Debugger;
CButton m_ReadCheck;
CButton m_WriteCheck;
CButton m_ExecuteCheck;
CEdit m_AddressEdit;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDestroy(void)
{
return 0;
}
BEGIN_MSG_MAP_EX(CAddBreakpointDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MSG_WM_DESTROY(OnDestroy)
END_MSG_MAP()
CButton m_ReadCheck;
CButton m_WriteCheck;
CButton m_ExecuteCheck;
CEdit m_AddressEdit;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDestroy(void)
{
return 0;
}
BEGIN_MSG_MAP_EX(CAddBreakpointDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MSG_WM_DESTROY(OnDestroy)
END_MSG_MAP()
};

View File

@ -16,35 +16,35 @@
class CAddSymbolDlg : public CDialogImpl<CAddSymbolDlg>
{
public:
enum { IDD = IDD_Debugger_AddSymbol };
enum { IDD = IDD_Debugger_AddSymbol };
INT_PTR DoModal(CDebuggerUI* debugger);
INT_PTR DoModal(CDebuggerUI* debugger, uint32_t initAddress);
INT_PTR DoModal(CDebuggerUI* debugger, uint32_t initAddress, int initType);
INT_PTR DoModal(CDebuggerUI* debugger);
INT_PTR DoModal(CDebuggerUI* debugger, uint32_t initAddress);
INT_PTR DoModal(CDebuggerUI* debugger, uint32_t initAddress, int initType);
private:
CDebuggerUI* m_Debugger;
CDebuggerUI* m_Debugger;
bool m_bHaveAddress;
bool m_bHaveType;
uint32_t m_InitAddress;
int m_InitType;
bool m_bHaveAddress;
bool m_bHaveType;
uint32_t m_InitAddress;
int m_InitType;
CEditNumber m_AddressEdit;
CComboBox m_TypeComboBox;
CEdit m_NameEdit;
CEdit m_DescriptionEdit;
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnDestroy(void)
{
return 0;
}
CEditNumber m_AddressEdit;
CComboBox m_TypeComboBox;
CEdit m_NameEdit;
CEdit m_DescriptionEdit;
BEGIN_MSG_MAP_EX(CAddSymbolDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MSG_WM_DESTROY(OnDestroy)
END_MSG_MAP()
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnDestroy(void)
{
return 0;
}
BEGIN_MSG_MAP_EX(CAddSymbolDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MSG_WM_DESTROY(OnDestroy)
END_MSG_MAP()
};

View File

@ -21,37 +21,37 @@
class CCommandList : public CWindowImpl<CCommandList, CListViewCtrl>
{
public:
enum {
COL_ARROWS,
COL_ADDRESS,
COL_COMMAND,
COL_PARAMETERS,
COL_SYMBOL
};
enum {
COL_ARROWS,
COL_ADDRESS,
COL_COMMAND,
COL_PARAMETERS,
COL_SYMBOL
};
enum {
ROW_HEIGHT = 13,
};
enum {
ROW_HEIGHT = 13,
};
void Attach(HWND hWndNew)
{
CListViewCtrl::Attach(hWndNew);
ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP);
AddColumn("", COL_ARROWS);
AddColumn("Address", COL_ADDRESS);
AddColumn("Command", COL_COMMAND);
AddColumn("Parameters", COL_PARAMETERS);
AddColumn("Symbol", COL_SYMBOL);
SetColumnWidth(COL_ARROWS, 30);
SetColumnWidth(COL_ADDRESS, 65);
SetColumnWidth(COL_COMMAND, 60);
SetColumnWidth(COL_PARAMETERS, 120);
SetColumnWidth(COL_SYMBOL, 140);
}
BEGIN_MSG_MAP_EX(CCommandsList)
END_MSG_MAP()
void Attach(HWND hWndNew)
{
CListViewCtrl::Attach(hWndNew);
ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_LABELTIP);
AddColumn("", COL_ARROWS);
AddColumn("Address", COL_ADDRESS);
AddColumn("Command", COL_COMMAND);
AddColumn("Parameters", COL_PARAMETERS);
AddColumn("Symbol", COL_SYMBOL);
SetColumnWidth(COL_ARROWS, 30);
SetColumnWidth(COL_ADDRESS, 65);
SetColumnWidth(COL_COMMAND, 60);
SetColumnWidth(COL_PARAMETERS, 120);
SetColumnWidth(COL_SYMBOL, 140);
}
BEGIN_MSG_MAP_EX(CCommandsList)
END_MSG_MAP()
};
class CEditOp;
@ -60,212 +60,212 @@ class CDebugCommandsView;
class CEditOp : public CWindowImpl<CEditOp, CEdit>
{
private:
CDebugCommandsView* m_CommandsWindow;
CDebugCommandsView* m_CommandsWindow;
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnKeyUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (wParam == VK_RETURN || wParam == VK_ESCAPE)
{
bHandled = TRUE;
return 0;
}
bHandled = FALSE;
return 0;
}
BEGIN_MSG_MAP_EX(CEditOp)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
MESSAGE_HANDLER(WM_KEYUP, OnKeyUp)
MESSAGE_HANDLER(WM_CHAR, OnKeyUp)
END_MSG_MAP()
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnKeyUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (wParam == VK_RETURN || wParam == VK_ESCAPE)
{
bHandled = TRUE;
return 0;
}
bHandled = FALSE;
return 0;
}
BEGIN_MSG_MAP_EX(CEditOp)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
MESSAGE_HANDLER(WM_KEYUP, OnKeyUp)
MESSAGE_HANDLER(WM_CHAR, OnKeyUp)
END_MSG_MAP()
public:
void SetCommandsWindow(CDebugCommandsView* commandsWindow);
BOOL Attach(HWND hWndNew);
void SetCommandsWindow(CDebugCommandsView* commandsWindow);
BOOL Attach(HWND hWndNew);
};
class CDebugCommandsView :
public CDebugDialog<CDebugCommandsView>,
public CDialogResize<CDebugCommandsView>,
public CToolTipDialog<CDebugCommandsView>
public CDebugDialog<CDebugCommandsView>,
public CDialogResize<CDebugCommandsView>,
public CToolTipDialog<CDebugCommandsView>
{
friend class CEditOp;
friend class CEditOp;
public:
enum { IDD = IDD_Debugger_Commands };
enum { IDD = IDD_Debugger_Commands };
CDebugCommandsView(CDebuggerUI * debugger);
virtual ~CDebugCommandsView(void);
CDebugCommandsView(CDebuggerUI * debugger);
virtual ~CDebugCommandsView(void);
void ShowAddress(DWORD address, BOOL top);
void ShowPIRegTab();
void Reset();
void ShowAddress(DWORD address, BOOL top);
void ShowPIRegTab();
void Reset();
private:
CBreakpoints* m_Breakpoints;
vector<uint32_t> m_History;
int m_HistoryIndex;
CBreakpoints* m_Breakpoints;
vector<uint32_t> m_History;
int m_HistoryIndex;
CAddBreakpointDlg m_AddBreakpointDlg;
CAddSymbolDlg m_AddSymbolDlg;
CAddBreakpointDlg m_AddBreakpointDlg;
CAddSymbolDlg m_AddSymbolDlg;
DWORD m_StartAddress;
CRect m_DefaultWindowRect;
DWORD m_StartAddress;
CRect m_DefaultWindowRect;
CEditNumber m_PCEdit;
bool m_bIgnorePCChange;
CEditNumber m_PCEdit;
bool m_bIgnorePCChange;
CEditNumber m_AddressEdit;
bool m_bIgnoreAddrChange;
CEditNumber m_AddressEdit;
bool m_bIgnoreAddrChange;
CCommandList m_CommandList;
int m_CommandListRows;
CListBox m_BreakpointList;
CScrollBar m_Scrollbar;
CCommandList m_CommandList;
int m_CommandListRows;
CListBox m_BreakpointList;
CScrollBar m_Scrollbar;
CRegisterTabs m_RegisterTabs;
CRegisterTabs m_RegisterTabs;
CButton m_BackButton;
CButton m_ForwardButton;
CButton m_BackButton;
CButton m_ForwardButton;
CButton m_ViewPCButton;
CButton m_StepButton;
CButton m_SkipButton;
CButton m_GoButton;
CButton m_ViewPCButton;
CButton m_StepButton;
CButton m_SkipButton;
CButton m_GoButton;
bool m_bEditing;
CEditOp m_OpEdit;
bool m_bEditing;
CEditOp m_OpEdit;
uint32_t m_SelectedAddress;
COpInfo m_SelectedOpInfo;
OPCODE& m_SelectedOpCode = m_SelectedOpInfo.m_OpCode;
uint32_t m_SelectedAddress;
COpInfo m_SelectedOpInfo;
OPCODE& m_SelectedOpCode = m_SelectedOpInfo.m_OpCode;
uint32_t m_FollowAddress;
uint32_t m_FollowAddress;
typedef struct {
uint32_t address;
uint32_t originalOp;
} EditedOp;
typedef struct {
uint32_t address;
uint32_t originalOp;
} EditedOp;
vector<EditedOp> m_EditedOps;
vector<EditedOp> m_EditedOps;
typedef struct {
int startPos;
int endPos;
int startMargin;
int endMargin;
int margin;
} BRANCHARROW;
typedef struct {
int startPos;
int endPos;
int startMargin;
int endMargin;
int margin;
} BRANCHARROW;
vector<BRANCHARROW> m_BranchArrows;
void AddBranchArrow(int startPos, int endPos);
void ClearBranchArrows();
void DrawBranchArrows(HDC listDC);
vector<BRANCHARROW> m_BranchArrows;
void AddBranchArrow(int startPos, int endPos);
void ClearBranchArrows();
void DrawBranchArrows(HDC listDC);
vector<bool> m_bvAnnotatedLines;
vector<bool> m_bvAnnotatedLines;
void ClearEditedOps();
void EditOp(uint32_t address, uint32_t op);
void RestoreOp(uint32_t address);
void RestoreAllOps();
BOOL IsOpEdited(uint32_t address);
void BeginOpEdit(uint32_t address);
void EndOpEdit();
void ClearEditedOps();
void EditOp(uint32_t address, uint32_t op);
void RestoreOp(uint32_t address);
void RestoreAllOps();
BOOL IsOpEdited(uint32_t address);
void BeginOpEdit(uint32_t address);
void EndOpEdit();
void GotoEnteredAddress();
void CheckCPUType();
void RefreshBreakpointList();
void RemoveSelectedBreakpoints();
bool AddressSafe(uint32_t vaddr);
void GotoEnteredAddress();
void CheckCPUType();
void RefreshBreakpointList();
void RemoveSelectedBreakpoints();
void HistoryPushState();
void ToggleHistoryButtons();
bool AddressSafe(uint32_t vaddr);
static CDebugCommandsView* _this;
static HHOOK hWinMessageHook;
static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
void InterceptKeyDown(WPARAM wParam, LPARAM lParam);
void InterceptMouseWheel(WPARAM wParam, LPARAM lParam);
void HistoryPushState();
void ToggleHistoryButtons();
static const char* GetCodeAddressNotes(uint32_t vAddr);
static const char* GetDataAddressNotes(uint32_t vAddr);
void CPUSkip();
void CPUStepInto();
void CPUResume();
static CDebugCommandsView* _this;
static HHOOK hWinMessageHook;
static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
void InterceptKeyDown(WPARAM wParam, LPARAM lParam);
void InterceptMouseWheel(WPARAM wParam, LPARAM lParam);
LRESULT OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnActivate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSizing (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnScroll (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMeasureItem (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnAddrChanged (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnPCChanged (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnListBoxClicked (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnClicked (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
static const char* GetCodeAddressNotes(uint32_t vAddr);
static const char* GetDataAddressNotes(uint32_t vAddr);
LRESULT OnOpKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCommandListClicked(NMHDR* pNMHDR);
LRESULT OnCommandListDblClicked(NMHDR* pNMHDR);
LRESULT OnCommandListRightClicked (NMHDR* pNMHDR);
LRESULT OnRegisterTabChange (NMHDR* pNMHDR);
LRESULT OnCustomDrawList (NMHDR* pNMHDR);
LRESULT OnDestroy (void);
void CPUSkip();
void CPUStepInto();
void CPUResume();
BEGIN_MSG_MAP_EX(CDebugCommandsView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
MESSAGE_HANDLER(WM_SIZING, OnSizing)
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem)
COMMAND_HANDLER(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
COMMAND_HANDLER(IDC_PC_EDIT, EN_CHANGE, OnPCChanged)
COMMAND_CODE_HANDLER(LBN_DBLCLK, OnListBoxClicked)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_CLICK, OnCommandListClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_DBLCLK, OnCommandListDblClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_RCLICK, OnCommandListRightClicked)
NOTIFY_HANDLER_EX(IDC_REG_TABS, TCN_SELCHANGE, OnRegisterTabChange)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
MSG_WM_DESTROY(OnDestroy)
CHAIN_MSG_MAP(CDialogResize<CDebugCommandsView>)
END_MSG_MAP()
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSizing(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnPCChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnListBoxClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
BEGIN_DLGRESIZE_MAP(CDebugCommandsView)
DLGRESIZE_CONTROL(IDC_GO_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_STEP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_SKIP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_ADDR_EDIT, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_SYMBOLS_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_OPCODE_BOX, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_BP_LIST, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_ADDBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_RMBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_CLEARBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_REG_TABS, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_BACK_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_FORWARD_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_PC_STATIC, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_PC_EDIT, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_VIEWPC_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_CMD_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_SCRL_BAR, DLSZ_MOVE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
LRESULT OnOpKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
BEGIN_TOOLTIP_MAP()
TOOLTIP(IDC_SKIP_BTN, "Skip (F1)")
TOOLTIP(IDC_STEP_BTN, "Step (F2)")
TOOLTIP(IDC_GO_BTN, "Go (F4)")
TOOLTIP(IDC_ADDBP_BTN, "Add breakpoint...")
TOOLTIP(IDC_RMBP_BTN, "Remove selected breakpoint")
TOOLTIP(IDC_CLEARBP_BTN, "Remove all breakpoints")
TOOLTIP(IDC_VIEWPC_BTN, "Jump to program counter")
TOOLTIP(IDC_BP_LIST, "Active breakpoints")
TOOLTIP(IDC_SYMBOLS_BTN, "Symbols...")
END_TOOLTIP_MAP()
LRESULT OnCommandListClicked(NMHDR* pNMHDR);
LRESULT OnCommandListDblClicked(NMHDR* pNMHDR);
LRESULT OnCommandListRightClicked(NMHDR* pNMHDR);
LRESULT OnRegisterTabChange(NMHDR* pNMHDR);
LRESULT OnCustomDrawList(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
BEGIN_MSG_MAP_EX(CDebugCommandsView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
MESSAGE_HANDLER(WM_SIZING, OnSizing)
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
MESSAGE_HANDLER(WM_VSCROLL, OnScroll)
MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem)
COMMAND_HANDLER(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
COMMAND_HANDLER(IDC_PC_EDIT, EN_CHANGE, OnPCChanged)
COMMAND_CODE_HANDLER(LBN_DBLCLK, OnListBoxClicked)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_CLICK, OnCommandListClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_DBLCLK, OnCommandListDblClicked)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_RCLICK, OnCommandListRightClicked)
NOTIFY_HANDLER_EX(IDC_REG_TABS, TCN_SELCHANGE, OnRegisterTabChange)
NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
MSG_WM_DESTROY(OnDestroy)
CHAIN_MSG_MAP(CDialogResize<CDebugCommandsView>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugCommandsView)
DLGRESIZE_CONTROL(IDC_GO_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_STEP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_SKIP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_ADDR_EDIT, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_SYMBOLS_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_OPCODE_BOX, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_BP_LIST, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_ADDBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_RMBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_CLEARBP_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_REG_TABS, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_BACK_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_FORWARD_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_PC_STATIC, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_PC_EDIT, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_VIEWPC_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_CMD_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_SCRL_BAR, DLSZ_MOVE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
BEGIN_TOOLTIP_MAP()
TOOLTIP(IDC_SKIP_BTN, "Skip (F1)")
TOOLTIP(IDC_STEP_BTN, "Step (F2)")
TOOLTIP(IDC_GO_BTN, "Go (F4)")
TOOLTIP(IDC_ADDBP_BTN, "Add breakpoint...")
TOOLTIP(IDC_RMBP_BTN, "Remove selected breakpoint")
TOOLTIP(IDC_CLEARBP_BTN, "Remove all breakpoints")
TOOLTIP(IDC_VIEWPC_BTN, "Jump to program counter")
TOOLTIP(IDC_BP_LIST, "Active breakpoints")
TOOLTIP(IDC_SYMBOLS_BTN, "Symbols...")
END_TOOLTIP_MAP()
};

View File

@ -14,66 +14,66 @@
#include "DebuggerUI.h"
class CDebugDMALogView :
public CDebugDialog<CDebugDMALogView>,
public CDialogResize<CDebugDMALogView>
public CDebugDialog<CDebugDMALogView>,
public CDialogResize<CDebugDMALogView>
{
public:
enum { IDD = IDD_Debugger_DMALog };
enum { IDD = IDD_Debugger_DMALog };
CDebugDMALogView(CDebuggerUI * debugger);
virtual ~CDebugDMALogView(void);
CDebugDMALogView(CDebuggerUI * debugger);
virtual ~CDebugDMALogView(void);
void RefreshList();
void RefreshList();
private:
CDMALog* m_DMALog;
CDMALog* m_DMALog;
int m_nLastStartIndex;
bool m_bConvertingAddress;
int m_nLastStartIndex;
bool m_bConvertingAddress;
bool m_bUniqueRomAddresses;
bool m_bFilterChanged;
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
bool m_bUniqueRomAddresses;
bool m_bFilterChanged;
// Return true if entry meets requirements
bool FilterEntry(int dmaLogIndex);
CListViewCtrl m_DMAList;
CEdit m_DMARamEdit;
CEdit m_DMARomEdit;
CStatic m_BlockInfo;
bool m_bCustomDrawClrNext;
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnRomAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCustomDrawList(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
// Return true if entry meets requirements
bool FilterEntry(int dmaLogIndex);
BEGIN_MSG_MAP_EX(CDebugDMALogView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
COMMAND_HANDLER(IDC_DMA_RAM_EDIT, EN_CHANGE, OnRamAddrChanged)
COMMAND_HANDLER(IDC_DMA_ROM_EDIT, EN_CHANGE, OnRomAddrChanged)
NOTIFY_HANDLER_EX(IDC_DMA_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
CHAIN_MSG_MAP(CDialogResize<CDebugDMALogView>)
END_MSG_MAP()
CListViewCtrl m_DMAList;
CEdit m_DMARamEdit;
CEdit m_DMARomEdit;
CStatic m_BlockInfo;
BEGIN_DLGRESIZE_MAP(CDebugDMALogView)
DLGRESIZE_CONTROL(IDC_DMA_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_TRACE_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_BLOCK_INFO, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_RAM_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_ROM_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_DMA_ROM_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_DMA_RAM_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_CLEAR_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_BUTTON1, DLSZ_MOVE_X | DLSZ_MOVE_Y)
END_DLGRESIZE_MAP()
bool m_bCustomDrawClrNext;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnRamAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnRomAddrChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCustomDrawList(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
BEGIN_MSG_MAP_EX(CDebugDMALogView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
COMMAND_HANDLER(IDC_DMA_RAM_EDIT, EN_CHANGE, OnRamAddrChanged)
COMMAND_HANDLER(IDC_DMA_ROM_EDIT, EN_CHANGE, OnRomAddrChanged)
NOTIFY_HANDLER_EX(IDC_DMA_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
CHAIN_MSG_MAP(CDialogResize<CDebugDMALogView>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugDMALogView)
DLGRESIZE_CONTROL(IDC_DMA_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_TRACE_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_BLOCK_INFO, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_RAM_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_ROM_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_DMA_ROM_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_DMA_RAM_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_CLEAR_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_BUTTON1, DLSZ_MOVE_X | DLSZ_MOVE_Y)
END_DLGRESIZE_MAP()
};

View File

@ -27,20 +27,20 @@ private:
enum DumpFormat
{
DisassemblyWithPC,
RawBigEndian
RawBigEndian
};
BEGIN_MSG_MAP_EX(CDumpMemory)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
END_MSG_MAP()
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
CComboBox m_FormatList;
CEdit m_FileName;
CEditNumber m_StartAddress, m_EndAddress, m_PC;
CComboBox m_FormatList;
CEdit m_FileName;
CEditNumber m_StartAddress, m_EndAddress, m_PC;
};

View File

@ -53,36 +53,36 @@ private:
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_DBLCLK, OnResultDblClick)
END_MSG_MAP()
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_DBLCLK, OnResultDblClick)
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnResultRClick(LPNMHDR lpnmh);
LRESULT OnResultDblClick(LPNMHDR lpnmh);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnResultRClick(LPNMHDR lpnmh);
LRESULT OnResultDblClick(LPNMHDR lpnmh);
void EnableUnknownOptions(bool Enable);
void EnableValueOptions(bool Enable);
void EnableTextOptions(bool Enable);
void EnableJalOptions(bool Enable);
void AddAlignmentOptions(CComboBox & ctrl);
void EnableUnknownOptions(bool Enable);
void EnableValueOptions(bool Enable);
void EnableTextOptions(bool Enable);
void EnableJalOptions(bool Enable);
void AddAlignmentOptions(CComboBox & ctrl);
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
CListViewCtrl m_SearchResults;
SearchResult m_SearchResult;
bool m_HaveResults;
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
CListViewCtrl m_SearchResults;
SearchResult m_SearchResult;
bool m_HaveResults;
//Searching memory
BYTE * m_MemoryState;
DWORD m_MemoryStateSize;
//Searching memory
BYTE * m_MemoryState;
DWORD m_MemoryStateSize;
void FixUnknownOptions(bool Reset);
void SearchForUnknown(void);
void SearchForValue(void);
void SearchForText(void);
void Reset(void);
bool SearchSetBaseForChanges(void);
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
void FixUnknownOptions(bool Reset);
void SearchForUnknown(void);
void SearchForValue(void);
void SearchForText(void);
void Reset(void);
bool SearchSetBaseForChanges(void);
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
};

View File

@ -15,268 +15,267 @@
#include "Breakpoints.h"
#ifndef COUNT_OF
#define COUNT_OF(a) (sizeof(a) / sizeof(a[0]))
#define COUNT_OF(a) (sizeof(a) / sizeof(a[0]))
#endif
class CEditReg64 : public CWindowImpl<CEditReg64, CEdit>
{
public:
static uint64_t ParseValue(char* wordPair);
BOOL Attach(HWND hWndNew);
LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLostFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
uint64_t GetValue();
void SetValue(uint32_t h, uint32_t l);
void SetValue(uint64_t value);
static uint64_t ParseValue(char* wordPair);
BOOL Attach(HWND hWndNew);
LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLostFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
uint64_t GetValue();
void SetValue(uint32_t h, uint32_t l);
void SetValue(uint64_t value);
BEGIN_MSG_MAP_EX(CRegEdit64)
MESSAGE_HANDLER(WM_CHAR, OnChar)
MESSAGE_HANDLER(WM_KILLFOCUS, OnLostFocus)
END_MSG_MAP()
BEGIN_MSG_MAP_EX(CRegEdit64)
MESSAGE_HANDLER(WM_CHAR, OnChar)
MESSAGE_HANDLER(WM_KILLFOCUS, OnLostFocus)
END_MSG_MAP()
};
class CRegisterTabs : public CTabCtrl
{
private:
typedef union
{
uint32_t intval;
typedef union
{
uint32_t intval;
struct {
unsigned : 2;
unsigned exceptionCode : 5;
unsigned : 1;
unsigned pendingInterrupts : 8;
unsigned : 12;
unsigned coprocessor : 2;
unsigned : 1;
unsigned fromDelaySlot : 1;
};
struct {
unsigned : 2;
unsigned exceptionCode : 5;
unsigned : 1;
unsigned pendingInterrupts : 8;
unsigned : 12;
unsigned coprocessor : 2;
unsigned : 1;
unsigned fromDelaySlot : 1;
};
} CAUSE;
} CAUSE;
enum TAB_ID {
TabDefault,
TabGPR,
TabFPR
};
enum TAB_ID {
TabDefault,
TabGPR,
TabFPR
};
static constexpr DWORD GPREditIds[] = {
IDC_R0_EDIT, IDC_R1_EDIT, IDC_R2_EDIT, IDC_R3_EDIT,
IDC_R4_EDIT, IDC_R5_EDIT, IDC_R6_EDIT, IDC_R7_EDIT,
IDC_R8_EDIT, IDC_R9_EDIT, IDC_R10_EDIT, IDC_R11_EDIT,
IDC_R12_EDIT, IDC_R13_EDIT, IDC_R14_EDIT, IDC_R15_EDIT,
IDC_R16_EDIT, IDC_R17_EDIT, IDC_R18_EDIT, IDC_R19_EDIT,
IDC_R20_EDIT, IDC_R21_EDIT, IDC_R22_EDIT, IDC_R23_EDIT,
IDC_R24_EDIT, IDC_R25_EDIT, IDC_R26_EDIT, IDC_R27_EDIT,
IDC_R28_EDIT, IDC_R29_EDIT, IDC_R30_EDIT, IDC_R31_EDIT,
0
};
static constexpr DWORD GPREditIds[] = {
IDC_R0_EDIT, IDC_R1_EDIT, IDC_R2_EDIT, IDC_R3_EDIT,
IDC_R4_EDIT, IDC_R5_EDIT, IDC_R6_EDIT, IDC_R7_EDIT,
IDC_R8_EDIT, IDC_R9_EDIT, IDC_R10_EDIT, IDC_R11_EDIT,
IDC_R12_EDIT, IDC_R13_EDIT, IDC_R14_EDIT, IDC_R15_EDIT,
IDC_R16_EDIT, IDC_R17_EDIT, IDC_R18_EDIT, IDC_R19_EDIT,
IDC_R20_EDIT, IDC_R21_EDIT, IDC_R22_EDIT, IDC_R23_EDIT,
IDC_R24_EDIT, IDC_R25_EDIT, IDC_R26_EDIT, IDC_R27_EDIT,
IDC_R28_EDIT, IDC_R29_EDIT, IDC_R30_EDIT, IDC_R31_EDIT,
0
};
static constexpr DWORD FPREditIds[] = {
IDC_F0_EDIT, IDC_F1_EDIT, IDC_F2_EDIT, IDC_F3_EDIT,
IDC_F4_EDIT, IDC_F5_EDIT, IDC_F6_EDIT, IDC_F7_EDIT,
IDC_F8_EDIT, IDC_F9_EDIT, IDC_F10_EDIT, IDC_F11_EDIT,
IDC_F12_EDIT, IDC_F13_EDIT, IDC_F14_EDIT, IDC_F15_EDIT,
IDC_F16_EDIT, IDC_F17_EDIT, IDC_F18_EDIT, IDC_F19_EDIT,
IDC_F20_EDIT, IDC_F21_EDIT, IDC_F22_EDIT, IDC_F23_EDIT,
IDC_F24_EDIT, IDC_F25_EDIT, IDC_F26_EDIT, IDC_F27_EDIT,
IDC_F28_EDIT, IDC_F29_EDIT, IDC_F30_EDIT, IDC_F31_EDIT,
0
};
static constexpr DWORD COP0EditIds[] = {
IDC_COP0_0_EDIT, IDC_COP0_1_EDIT, IDC_COP0_2_EDIT, IDC_COP0_3_EDIT,
IDC_COP0_4_EDIT, IDC_COP0_5_EDIT, IDC_COP0_6_EDIT, IDC_COP0_7_EDIT,
IDC_COP0_8_EDIT, IDC_COP0_9_EDIT, IDC_COP0_10_EDIT, IDC_COP0_11_EDIT,
IDC_COP0_12_EDIT, IDC_COP0_13_EDIT, IDC_COP0_14_EDIT, IDC_COP0_15_EDIT,
IDC_COP0_16_EDIT, IDC_COP0_17_EDIT, IDC_COP0_18_EDIT,
0
};
static constexpr DWORD FPREditIds[] = {
IDC_F0_EDIT, IDC_F1_EDIT, IDC_F2_EDIT, IDC_F3_EDIT,
IDC_F4_EDIT, IDC_F5_EDIT, IDC_F6_EDIT, IDC_F7_EDIT,
IDC_F8_EDIT, IDC_F9_EDIT, IDC_F10_EDIT, IDC_F11_EDIT,
IDC_F12_EDIT, IDC_F13_EDIT, IDC_F14_EDIT, IDC_F15_EDIT,
IDC_F16_EDIT, IDC_F17_EDIT, IDC_F18_EDIT, IDC_F19_EDIT,
IDC_F20_EDIT, IDC_F21_EDIT, IDC_F22_EDIT, IDC_F23_EDIT,
IDC_F24_EDIT, IDC_F25_EDIT, IDC_F26_EDIT, IDC_F27_EDIT,
IDC_F28_EDIT, IDC_F29_EDIT, IDC_F30_EDIT, IDC_F31_EDIT,
0
};
static constexpr DWORD RDRAMEditIds[] = {
IDC_RDRAM00_EDIT, IDC_RDRAM04_EDIT, IDC_RDRAM08_EDIT, IDC_RDRAM0C_EDIT,
IDC_RDRAM10_EDIT, IDC_RDRAM14_EDIT, IDC_RDRAM18_EDIT, IDC_RDRAM1C_EDIT,
IDC_RDRAM20_EDIT, IDC_RDRAM24_EDIT,
0
};
static constexpr DWORD COP0EditIds[] = {
IDC_COP0_0_EDIT, IDC_COP0_1_EDIT, IDC_COP0_2_EDIT, IDC_COP0_3_EDIT,
IDC_COP0_4_EDIT, IDC_COP0_5_EDIT, IDC_COP0_6_EDIT, IDC_COP0_7_EDIT,
IDC_COP0_8_EDIT, IDC_COP0_9_EDIT, IDC_COP0_10_EDIT, IDC_COP0_11_EDIT,
IDC_COP0_12_EDIT, IDC_COP0_13_EDIT, IDC_COP0_14_EDIT, IDC_COP0_15_EDIT,
IDC_COP0_16_EDIT, IDC_COP0_17_EDIT, IDC_COP0_18_EDIT,
0
};
static constexpr DWORD SPEditIds[] = {
IDC_SP00_EDIT, IDC_SP04_EDIT, IDC_SP08_EDIT, IDC_SP0C_EDIT,
IDC_SP10_EDIT, IDC_SP14_EDIT, IDC_SP18_EDIT, IDC_SP1C_EDIT,
0
};
static constexpr DWORD RDRAMEditIds[] = {
IDC_RDRAM00_EDIT, IDC_RDRAM04_EDIT, IDC_RDRAM08_EDIT, IDC_RDRAM0C_EDIT,
IDC_RDRAM10_EDIT, IDC_RDRAM14_EDIT, IDC_RDRAM18_EDIT, IDC_RDRAM1C_EDIT,
IDC_RDRAM20_EDIT, IDC_RDRAM24_EDIT,
0
};
static constexpr DWORD DPCEditIds[] = {
IDC_DPC00_EDIT, IDC_DPC04_EDIT, IDC_DPC08_EDIT, IDC_DPC0C_EDIT,
IDC_DPC10_EDIT, IDC_DPC14_EDIT, IDC_DPC18_EDIT, IDC_DPC1C_EDIT,
0
};
static constexpr DWORD SPEditIds[] = {
IDC_SP00_EDIT, IDC_SP04_EDIT, IDC_SP08_EDIT, IDC_SP0C_EDIT,
IDC_SP10_EDIT, IDC_SP14_EDIT, IDC_SP18_EDIT, IDC_SP1C_EDIT,
0
};
static constexpr DWORD MIEditIds[] = {
IDC_MI00_EDIT, IDC_MI04_EDIT, IDC_MI08_EDIT, IDC_MI0C_EDIT,
0
};
static constexpr DWORD DPCEditIds[] = {
IDC_DPC00_EDIT, IDC_DPC04_EDIT, IDC_DPC08_EDIT, IDC_DPC0C_EDIT,
IDC_DPC10_EDIT, IDC_DPC14_EDIT, IDC_DPC18_EDIT, IDC_DPC1C_EDIT,
0
};
static constexpr DWORD VIEditIds[] = {
IDC_VI00_EDIT, IDC_VI04_EDIT, IDC_VI08_EDIT, IDC_VI0C_EDIT,
IDC_VI10_EDIT, IDC_VI14_EDIT, IDC_VI18_EDIT, IDC_VI1C_EDIT,
IDC_VI20_EDIT, IDC_VI24_EDIT, IDC_VI28_EDIT, IDC_VI2C_EDIT,
IDC_VI30_EDIT, IDC_VI34_EDIT,
0
};
static constexpr DWORD MIEditIds[] = {
IDC_MI00_EDIT, IDC_MI04_EDIT, IDC_MI08_EDIT, IDC_MI0C_EDIT,
0
};
static constexpr DWORD AIEditIds[] = {
IDC_AI00_EDIT, IDC_AI04_EDIT, IDC_AI08_EDIT, IDC_AI0C_EDIT,
IDC_AI10_EDIT, IDC_AI14_EDIT,
0
};
static constexpr DWORD PIEditIds[] = {
IDC_PI00_EDIT, IDC_PI04_EDIT, IDC_PI08_EDIT, IDC_PI0C_EDIT,
IDC_PI10_EDIT, IDC_PI14_EDIT, IDC_PI18_EDIT, IDC_PI1C_EDIT,
IDC_PI20_EDIT, IDC_PI24_EDIT, IDC_PI28_EDIT, IDC_PI2C_EDIT,
IDC_PI30_EDIT,
0
};
static constexpr DWORD VIEditIds[] = {
IDC_VI00_EDIT, IDC_VI04_EDIT, IDC_VI08_EDIT, IDC_VI0C_EDIT,
IDC_VI10_EDIT, IDC_VI14_EDIT, IDC_VI18_EDIT, IDC_VI1C_EDIT,
IDC_VI20_EDIT, IDC_VI24_EDIT, IDC_VI28_EDIT, IDC_VI2C_EDIT,
IDC_VI30_EDIT, IDC_VI34_EDIT,
0
};
static constexpr DWORD RIEditIds[] = {
IDC_RI00_EDIT, IDC_RI04_EDIT, IDC_RI08_EDIT, IDC_RI0C_EDIT,
IDC_RI10_EDIT, IDC_RI14_EDIT, IDC_RI18_EDIT, IDC_RI1C_EDIT,
0
};
static constexpr DWORD SIEditIds[] = {
IDC_SI00_EDIT, IDC_SI04_EDIT, IDC_SI08_EDIT, IDC_SI0C_EDIT,
0
};
static constexpr DWORD AIEditIds[] = {
IDC_AI00_EDIT, IDC_AI04_EDIT, IDC_AI08_EDIT, IDC_AI0C_EDIT,
IDC_AI10_EDIT, IDC_AI14_EDIT,
0
};
static constexpr DWORD DDEditIds[] = {
IDC_DD00_EDIT, IDC_DD04_EDIT, IDC_DD08_EDIT, IDC_DD0C_EDIT,
IDC_DD10_EDIT, IDC_DD14_EDIT, IDC_DD18_EDIT, IDC_DD1C_EDIT,
IDC_DD20_EDIT, IDC_DD24_EDIT, IDC_DD28_EDIT, IDC_DD2C_EDIT,
IDC_DD30_EDIT, IDC_DD34_EDIT, IDC_DD38_EDIT, IDC_DD3C_EDIT,
IDC_DD40_EDIT, IDC_DD44_EDIT, IDC_DD48_EDIT,
0
};
static constexpr DWORD PIEditIds[] = {
IDC_PI00_EDIT, IDC_PI04_EDIT, IDC_PI08_EDIT, IDC_PI0C_EDIT,
IDC_PI10_EDIT, IDC_PI14_EDIT, IDC_PI18_EDIT, IDC_PI1C_EDIT,
IDC_PI20_EDIT, IDC_PI24_EDIT, IDC_PI28_EDIT, IDC_PI2C_EDIT,
IDC_PI30_EDIT,
0
};
static int MapEditRegNum(DWORD controlId, const DWORD* edits)
{
for (int i = 0; edits[i] != 0; i++)
{
if (edits[i] == controlId)
{
return i;
}
}
return -1;
}
static constexpr char* ExceptionCodes[] = {
"Interrupt",
"TLB mod",
"TLB load/fetch",
"TLB store",
"Address error (load/fetch)",
"Address error (store)",
"Bus error (instruction fetch)",
"Bus error (data load/store)",
"Syscall",
"Breakpoint",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap",
"Virtual coherency (instruction)",
"Floating-point",
"? 16",
"? 17",
"? 18",
"? 19",
"? 20",
"? 21",
"? 22",
"Watch",
"? 24",
"? 25",
"? 26",
"? 27",
"? 28",
"? 29",
"? 30",
"Virtual coherency (data)"
};
// for static dlgprocs, assumes single instance
static bool m_bColorsEnabled;
static constexpr DWORD RIEditIds[] = {
IDC_RI00_EDIT, IDC_RI04_EDIT, IDC_RI08_EDIT, IDC_RI0C_EDIT,
IDC_RI10_EDIT, IDC_RI14_EDIT, IDC_RI18_EDIT, IDC_RI1C_EDIT,
0
};
vector<CWindow> m_TabWindows;
static constexpr DWORD SIEditIds[] = {
IDC_SI00_EDIT, IDC_SI04_EDIT, IDC_SI08_EDIT, IDC_SI0C_EDIT,
0
};
CWindow m_GPRTab;
CEditReg64 m_GPREdits[COUNT_OF(GPREditIds) - 1];
CEditReg64 m_HIEdit;
CEditReg64 m_LOEdit;
CWindow m_FPRTab;
CEditNumber m_FPREdits[COUNT_OF(FPREditIds) - 1];
CEditNumber m_FCSREdit;
CWindow m_COP0Tab;
CEditNumber m_COP0Edits[COUNT_OF(COP0EditIds) - 1];
CStatic m_CauseTip;
static constexpr DWORD DDEditIds[] = {
IDC_DD00_EDIT, IDC_DD04_EDIT, IDC_DD08_EDIT, IDC_DD0C_EDIT,
IDC_DD10_EDIT, IDC_DD14_EDIT, IDC_DD18_EDIT, IDC_DD1C_EDIT,
IDC_DD20_EDIT, IDC_DD24_EDIT, IDC_DD28_EDIT, IDC_DD2C_EDIT,
IDC_DD30_EDIT, IDC_DD34_EDIT, IDC_DD38_EDIT, IDC_DD3C_EDIT,
IDC_DD40_EDIT, IDC_DD44_EDIT, IDC_DD48_EDIT,
0
};
CWindow m_RDRAMTab;
CEditNumber m_RDRAMEdits[COUNT_OF(RDRAMEditIds) - 1];
static int MapEditRegNum(DWORD controlId, const DWORD* edits)
{
for (int i = 0; edits[i] != 0; i++)
{
if (edits[i] == controlId)
{
return i;
}
}
return -1;
}
CWindow m_SPTab;
CEditNumber m_SPEdits[COUNT_OF(SPEditIds) - 1];
CEditNumber m_SPPCEdit;
static constexpr char* ExceptionCodes[] = {
"Interrupt",
"TLB mod",
"TLB load/fetch",
"TLB store",
"Address error (load/fetch)",
"Address error (store)",
"Bus error (instruction fetch)",
"Bus error (data load/store)",
"Syscall",
"Breakpoint",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap",
"Virtual coherency (instruction)",
"Floating-point",
"? 16",
"? 17",
"? 18",
"? 19",
"? 20",
"? 21",
"? 22",
"Watch",
"? 24",
"? 25",
"? 26",
"? 27",
"? 28",
"? 29",
"? 30",
"Virtual coherency (data)"
};
CWindow m_DPCTab;
CEditNumber m_DPCEdits[COUNT_OF(DPCEditIds) - 1];
// for static dlgprocs, assumes single instance
static bool m_bColorsEnabled;
CWindow m_MITab;
CEditNumber m_MIEdits[COUNT_OF(MIEditIds) - 1];
CWindow m_VITab;
CEditNumber m_VIEdits[COUNT_OF(VIEditIds) - 1];
vector<CWindow> m_TabWindows;
CWindow m_AITab;
CEditNumber m_AIEdits[COUNT_OF(AIEditIds) - 1];
CWindow m_GPRTab;
CEditReg64 m_GPREdits[COUNT_OF(GPREditIds) - 1];
CEditReg64 m_HIEdit;
CEditReg64 m_LOEdit;
CWindow m_PITab;
CEditNumber m_PIEdits[COUNT_OF(PIEditIds) - 1];
CWindow m_RITab;
CEditNumber m_RIEdits[COUNT_OF(RIEditIds) - 1];
CWindow m_FPRTab;
CEditNumber m_FPREdits[COUNT_OF(FPREditIds) - 1];
CEditNumber m_FCSREdit;
CWindow m_SITab;
CEditNumber m_SIEdits[COUNT_OF(SIEditIds) - 1];
CWindow m_COP0Tab;
CEditNumber m_COP0Edits[COUNT_OF(COP0EditIds) - 1];
CStatic m_CauseTip;
CWindow m_DDTab;
CEditNumber m_DDEdits[COUNT_OF(DDEditIds) - 1];
static void RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam);
CWindow m_RDRAMTab;
CEditNumber m_RDRAMEdits[COUNT_OF(RDRAMEditIds) - 1];
static INT_PTR CALLBACK TabProcDefault(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
CWindow m_SPTab;
CEditNumber m_SPEdits[COUNT_OF(SPEditIds) - 1];
CEditNumber m_SPPCEdit;
static void InitRegisterEdit(CWindow& tab, CEditNumber& edit, WORD ctrlId, HFONT font);
static void InitRegisterEdits(CWindow& tab, CEditNumber* edits, const DWORD* ctrlIds, HFONT font);
static void InitRegisterEdit64(CWindow& tab, CEditReg64& edit, WORD ctrlId, HFONT font);
static void InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const DWORD* ctrlIds, HFONT font);
static void ZeroRegisterEdit(CEditNumber& edit);
static void ZeroRegisterEdits(CEditNumber* edits, const DWORD* ctrlIds);
static void ZeroRegisterEdit64(CEditReg64& edit);
static void ZeroRegisterEdits64(CEditReg64* edits, const DWORD* ctrlIds);
CWindow m_DPCTab;
CEditNumber m_DPCEdits[COUNT_OF(DPCEditIds) - 1];
CWindow m_MITab;
CEditNumber m_MIEdits[COUNT_OF(MIEditIds) - 1];
CWindow m_VITab;
CEditNumber m_VIEdits[COUNT_OF(VIEditIds) - 1];
CWindow m_AITab;
CEditNumber m_AIEdits[COUNT_OF(AIEditIds) - 1];
CWindow m_PITab;
CEditNumber m_PIEdits[COUNT_OF(PIEditIds) - 1];
CWindow m_RITab;
CEditNumber m_RIEdits[COUNT_OF(RIEditIds) - 1];
CWindow m_SITab;
CEditNumber m_SIEdits[COUNT_OF(SIEditIds) - 1];
CWindow m_DDTab;
CEditNumber m_DDEdits[COUNT_OF(DDEditIds) - 1];
static void RegisterChanged(HWND hDlg, TAB_ID srcTabId, WPARAM wParam);
static INT_PTR CALLBACK TabProcDefault(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK TabProcFPR(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static void InitRegisterEdit(CWindow& tab, CEditNumber& edit, WORD ctrlId, HFONT font);
static void InitRegisterEdits(CWindow& tab, CEditNumber* edits, const DWORD* ctrlIds, HFONT font);
static void InitRegisterEdit64(CWindow& tab, CEditReg64& edit, WORD ctrlId, HFONT font);
static void InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const DWORD* ctrlIds, HFONT font);
static void ZeroRegisterEdit(CEditNumber& edit);
static void ZeroRegisterEdits(CEditNumber* edits, const DWORD* ctrlIds);
static void ZeroRegisterEdit64(CEditReg64& edit);
static void ZeroRegisterEdits64(CEditReg64* edits, const DWORD* ctrlIds);
public:
void Attach(HWND hWndNew);
CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc);
void ShowTab(int nPage);
CRect GetPageRect();
void RedrawCurrentTab();
void RefreshEdits();
void SetColorsEnabled(bool bColorsEnabled);
void Attach(HWND hWndNew);
CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc);
void ShowTab(int nPage);
CRect GetPageRect();
void RedrawCurrentTab();
void RefreshEdits();
void SetColorsEnabled(bool bColorsEnabled);
};

View File

@ -16,128 +16,127 @@
class CScriptList : public CListViewCtrl
{
public:
BEGIN_MSG_MAP_EX(CScriptList)
END_MSG_MAP()
BEGIN_MSG_MAP_EX(CScriptList)
END_MSG_MAP()
};
class CEditEval : public CWindowImpl<CEditEval, CEdit>
{
private:
//static char* m_EvalString;
static const int HISTORY_MAX_ENTRIES = 20;
vector<char*> m_History;
int m_HistoryIdx;
CDebugScripts* m_ScriptWindow;
//static char* m_EvalString;
static const int HISTORY_MAX_ENTRIES = 20;
vector<char*> m_History;
int m_HistoryIdx;
CDebugScripts* m_ScriptWindow;
public:
CEditEval()
{
m_HistoryIdx = 0;
}
void SetScriptWindow(CDebugScripts* scriptWindow)
{
m_ScriptWindow = scriptWindow;
}
CEditEval()
{
m_HistoryIdx = 0;
}
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
BOOL Attach(HWND hWndNew)
{
return SubclassWindow(hWndNew);
}
void SetScriptWindow(CDebugScripts* scriptWindow)
{
m_ScriptWindow = scriptWindow;
}
BEGIN_MSG_MAP_EX(CEditEval)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
END_MSG_MAP()
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
BOOL Attach(HWND hWndNew)
{
return SubclassWindow(hWndNew);
}
BEGIN_MSG_MAP_EX(CEditEval)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
END_MSG_MAP()
};
class CEditConsole : public CWindowImpl<CEditEval, CEdit>
{
private:
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (GetKeyState(VK_CONTROL) < 0)
{
if (wParam == 'A')
{
this->SetSelAll();
}
}
return FALSE;
}
LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (GetKeyState(VK_CONTROL) < 0)
{
if (wParam == 'A')
{
this->SetSelAll();
}
}
return FALSE;
}
public:
BOOL Attach(HWND hWndNew)
{
return SubclassWindow(hWndNew);
}
BOOL Attach(HWND hWndNew)
{
return SubclassWindow(hWndNew);
}
BEGIN_MSG_MAP_EX(CEditEval)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
END_MSG_MAP()
BEGIN_MSG_MAP_EX(CEditEval)
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
END_MSG_MAP()
};
class CDebugScripts :
public CDebugDialog < CDebugScripts >,
public CDialogResize<CDebugScripts>
public CDebugDialog < CDebugScripts >,
public CDialogResize<CDebugScripts>
{
private:
CEdit m_InstanceInfoEdit;
CEditEval m_EvalEdit;
CEditConsole m_ConsoleEdit;
CScriptList m_ScriptList;
char* m_SelectedScriptName;
CEdit m_InstanceInfoEdit;
CEditEval m_EvalEdit;
CEditConsole m_ConsoleEdit;
CScriptList m_ScriptList;
char* m_SelectedScriptName;
void RefreshStatus();
void RefreshStatus();
public:
enum { IDD = IDD_Debugger_Scripts };
enum { IDD = IDD_Debugger_Scripts };
CDebugScripts(CDebuggerUI * debugger);
virtual ~CDebugScripts(void);
CDebugScripts(CDebuggerUI * debugger);
virtual ~CDebugScripts(void);
void ConsolePrint(const char* text);
void ConsoleClear();
void ConsoleCopy();
void ConsolePrint(const char* text);
void ConsoleClear();
void ConsoleCopy();
void RefreshList();
void RefreshConsole();
void RefreshList();
void RefreshConsole();
void EvaluateInSelectedInstance(char* code);
void RunSelected();
void StopSelected();
void EvaluateInSelectedInstance(char* code);
void RunSelected();
void StopSelected();
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(void)
{
return 0;
}
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnScriptListDblClicked(NMHDR* pNMHDR);
LRESULT OnScriptListClicked(NMHDR* pNMHDR);
LRESULT OnScriptListRClicked(NMHDR* pNMHDR);
LRESULT OnScriptListCustomDraw(NMHDR* pNMHDR);
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(void)
{
return 0;
}
BEGIN_MSG_MAP_EX(CDebugScripts)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_DBLCLK, OnScriptListDblClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_CLICK, OnScriptListClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_RCLICK, OnScriptListRClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_CUSTOMDRAW, OnScriptListCustomDraw)
CHAIN_MSG_MAP_MEMBER(m_ScriptList)
MSG_WM_DESTROY(OnDestroy)
CHAIN_MSG_MAP(CDialogResize<CDebugScripts>)
END_MSG_MAP()
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnScriptListDblClicked(NMHDR* pNMHDR);
LRESULT OnScriptListClicked(NMHDR* pNMHDR);
LRESULT OnScriptListRClicked(NMHDR* pNMHDR);
LRESULT OnScriptListCustomDraw(NMHDR* pNMHDR);
BEGIN_DLGRESIZE_MAP(CDebugScripts)
DLGRESIZE_CONTROL(IDC_CTX_INFO_EDIT, DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_EVAL_EDIT, DLSZ_SIZE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_CONSOLE_EDIT, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_SCRIPT_LIST, DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_CLEAR_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_COPY_BTN, DLSZ_MOVE_X)
END_DLGRESIZE_MAP()
BEGIN_MSG_MAP_EX(CDebugScripts)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_DBLCLK, OnScriptListDblClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_CLICK, OnScriptListClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_RCLICK, OnScriptListRClicked)
NOTIFY_HANDLER_EX(IDC_SCRIPT_LIST, NM_CUSTOMDRAW, OnScriptListCustomDraw)
CHAIN_MSG_MAP_MEMBER(m_ScriptList)
MSG_WM_DESTROY(OnDestroy)
CHAIN_MSG_MAP(CDialogResize<CDebugScripts>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugScripts)
DLGRESIZE_CONTROL(IDC_CTX_INFO_EDIT, DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_EVAL_EDIT, DLSZ_SIZE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_CONSOLE_EDIT, DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_SCRIPT_LIST, DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_CLEAR_BTN, DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_COPY_BTN, DLSZ_MOVE_X)
END_DLGRESIZE_MAP()
};

View File

@ -15,51 +15,51 @@
#define STACKTRACE_MAX_ENTRIES 100
typedef struct {
uint32_t routineAddress;
uint32_t callingAddress;
uint32_t routineAddress;
uint32_t callingAddress;
} STACKTRACE_ENTRY;
class CDebugStackTrace :
public CDebugDialog<CDebugStackTrace>,
public CDialogResize<CDebugStackTrace>
public CDebugDialog<CDebugStackTrace>,
public CDialogResize<CDebugStackTrace>
{
public:
enum { IDD = IDD_Debugger_StackTrace };
enum { IDD = IDD_Debugger_StackTrace };
CDebugStackTrace(CDebuggerUI * debugger);
virtual ~CDebugStackTrace(void);
CDebugStackTrace(CDebuggerUI * debugger);
virtual ~CDebugStackTrace(void);
void Refresh();
void Refresh();
void PushEntry(uint32_t routineAddress, uint32_t callingAddress);
void PopEntry();
void ClearEntries();
void PushEntry(uint32_t routineAddress, uint32_t callingAddress);
void PopEntry();
void ClearEntries();
private:
STACKTRACE_ENTRY m_Entries[STACKTRACE_MAX_ENTRIES];
int m_EntriesIndex;
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
CListViewCtrl m_List;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnListDblClicked(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
STACKTRACE_ENTRY m_Entries[STACKTRACE_MAX_ENTRIES];
int m_EntriesIndex;
BEGIN_MSG_MAP_EX(CDebugStackTrace)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_STACKTRACE_LIST, NM_DBLCLK, OnListDblClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugStackTrace>)
END_MSG_MAP()
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
BEGIN_DLGRESIZE_MAP(CDebugStackTrace)
DLGRESIZE_CONTROL(IDC_STACKTRACE_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
CListViewCtrl m_List;
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnListDblClicked(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
BEGIN_MSG_MAP_EX(CDebugStackTrace)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_STACKTRACE_LIST, NM_DBLCLK, OnListDblClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugStackTrace>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugStackTrace)
DLGRESIZE_CONTROL(IDC_STACKTRACE_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
};

View File

@ -11,35 +11,34 @@
#pragma once
class CDebugStackView :
public CDebugDialog<CDebugStackView>,
public CDialogResize<CDebugStackView>
public CDebugDialog<CDebugStackView>,
public CDialogResize<CDebugStackView>
{
public:
enum { IDD = IDD_Debugger_Stack };
enum { IDD = IDD_Debugger_Stack };
CDebugStackView(CDebuggerUI * debugger);
virtual ~CDebugStackView(void);
void Refresh();
CDebugStackView(CDebuggerUI * debugger);
virtual ~CDebugStackView(void);
void Refresh();
private:
CListViewCtrl m_StackList;
CStatic m_SPStatic;
CListViewCtrl m_StackList;
CStatic m_SPStatic;
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(void);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(void);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
BEGIN_MSG_MAP_EX(CDebugStackView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MSG_WM_DESTROY(OnDestroy)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugStackView>)
END_MSG_MAP()
BEGIN_MSG_MAP_EX(CDebugStackView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MSG_WM_DESTROY(OnDestroy)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugStackView>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugStackView)
DLGRESIZE_CONTROL(IDC_STACK_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
BEGIN_DLGRESIZE_MAP(CDebugStackView)
DLGRESIZE_CONTROL(IDC_STACK_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
};

View File

@ -15,47 +15,45 @@
// todo maybe add char* ownerName and use a TreeView
class CDebugSymbols :
public CDebugDialog<CDebugSymbols>,
public CDialogResize<CDebugSymbols>
public CDebugDialog<CDebugSymbols>,
public CDialogResize<CDebugSymbols>
{
private:
CListViewCtrl m_SymbolsListView;
CAddSymbolDlg m_AddSymbolDlg;
CListViewCtrl m_SymbolsListView;
CAddSymbolDlg m_AddSymbolDlg;
HANDLE m_AutoRefreshThread;
static DWORD WINAPI CDebugSymbols::AutoRefreshProc(void* _this);
HANDLE m_AutoRefreshThread;
static DWORD WINAPI CDebugSymbols::AutoRefreshProc(void* _this);
public:
enum { IDD = IDD_Debugger_Symbols };
CDebugSymbols(CDebuggerUI * debugger);
//virtual ~CDebugScripts(void);
void Refresh();
void RefreshValues();
enum { IDD = IDD_Debugger_Symbols };
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnListDblClicked(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
CDebugSymbols(CDebuggerUI * debugger);
//virtual ~CDebugScripts(void);
BEGIN_MSG_MAP_EX(CDebugSymbols)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MSG_WM_DESTROY(OnDestroy)
NOTIFY_HANDLER_EX(IDC_SYMBOLS_LIST, NM_DBLCLK, OnListDblClicked)
//NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_RCLICK, OnListClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugSymbols>)
END_MSG_MAP()
void Refresh();
void RefreshValues();
BEGIN_DLGRESIZE_MAP(CDebugSymbols)
DLGRESIZE_CONTROL(IDC_FILTER_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_FILTER_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_REMOVESYMBOL_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_ADDSYMBOL_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_SYMBOLS_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnListDblClicked(NMHDR* pNMHDR);
LRESULT OnDestroy(void);
BEGIN_MSG_MAP_EX(CDebugSymbols)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MSG_WM_DESTROY(OnDestroy)
NOTIFY_HANDLER_EX(IDC_SYMBOLS_LIST, NM_DBLCLK, OnListDblClicked)
//NOTIFY_HANDLER_EX(IDC_CMD_LIST, NM_RCLICK, OnListClicked)
CHAIN_MSG_MAP(CDialogResize<CDebugSymbols>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CDebugSymbols)
DLGRESIZE_CONTROL(IDC_FILTER_EDIT, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_FILTER_STATIC, DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_REMOVESYMBOL_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_ADDSYMBOL_BTN, DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_SYMBOLS_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
};

View File

@ -16,10 +16,10 @@ class CDebugTlb :
BEGIN_MSG_MAP_EX(CDebugTlb)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
END_MSG_MAP()
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
public:
enum { IDD = IDD_Debugger_TLB };

View File

@ -24,59 +24,59 @@ public:
void ShowAddress(DWORD Address, bool VAddr);
private:
BEGIN_MSG_MAP_EX(CDebugMemoryView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
BEGIN_MSG_MAP_EX(CDebugMemoryView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked)
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged)
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_VSCROLL(OnVScroll)
END_MSG_MAP()
END_MSG_MAP()
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
void OnAddrChanged(UINT Code, int id, HWND ctl);
void OnVScroll(int request, short Pos, HWND ctrl);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);
LRESULT OnHotItemChanged(LPNMHDR lpNMHDR);
LRESULT OnDestroy(void);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
void OnAddrChanged(UINT Code, int id, HWND ctl);
void OnVScroll(int request, short Pos, HWND ctrl);
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);
LRESULT OnHotItemChanged(LPNMHDR lpNMHDR);
LRESULT OnDestroy(void);
void Insert_MemoryLineDump(int LineNumber);
void RefreshMemory(bool ResetCompare);
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
HANDLE m_AutoRefreshThread;
static DWORD WINAPI AutoRefreshProc(void* _this);
void SelectColors(uint32_t address, bool changed, COLORREF& bgColor, COLORREF& fgColor, COLORREF& fgHiColor);
bool GetItemOffset(LPNMHDR lpNMHDR, uint32_t &offset);
bool GetItemAddress(LPNMHDR lpNMHDR, uint32_t &address);
void SelectColors(uint32_t address, bool changed, COLORREF& bgColor, COLORREF& fgColor, COLORREF& fgHiColor);
bool GetItemOffset(LPNMHDR lpNMHDR, uint32_t &offset);
bool GetItemAddress(LPNMHDR lpNMHDR, uint32_t &address);
bool AddressSafe(uint32_t vaddr);
bool AddressSafe(uint32_t vaddr);
enum { MemoryToDisplay = 0x100 };
static CDebugMemoryView* _this;
static HHOOK hWinMessageHook;
static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
void InterceptMouseWheel(WPARAM wParam, LPARAM lParam);
static CDebugMemoryView* _this;
static HHOOK hWinMessageHook;
static LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
void InterceptMouseWheel(WPARAM wParam, LPARAM lParam);
CEditNumber m_MemAddr;
CListCtrl * m_MemoryList;
CAddSymbolDlg m_AddSymbolDlg;
CStatic m_SymInfo;
CStatic m_DMAInfo;
CAddSymbolDlg m_AddSymbolDlg;
CStatic m_SymInfo;
CStatic m_DMAInfo;
CBreakpoints* m_Breakpoints;
int m_SymbolColorStride;
int m_SymbolColorPhase;
DWORD m_CtxMenuAddr;
CBreakpoints* m_Breakpoints;
int m_SymbolColorStride;
int m_SymbolColorPhase;
DWORD m_CtxMenuAddr;
DWORD m_DataStartLoc;
bool m_DataVAddrr;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include "../../WTLApp.h"
#include "../../N64System.h"

View File

@ -13,194 +13,194 @@
class CScriptSystem;
typedef enum {
STATE_STARTED, // initial evaluation & execution
STATE_RUNNING, // event loop running with pending events
STATE_STOPPED, // no pending events
STATE_INVALID
STATE_STARTED, // initial evaluation & execution
STATE_RUNNING, // event loop running with pending events
STATE_STOPPED, // no pending events
STATE_INVALID
} INSTANCE_STATE;
class CScriptInstance
{
typedef enum {
EVENT_READ,
EVENT_WRITE,
EVENT_ACCEPT,
EVENT_CONNECT
} IOEVENTTYPE;
typedef enum {
EVENT_READ,
EVENT_WRITE,
EVENT_ACCEPT,
EVENT_CONNECT
} IOEVENTTYPE;
typedef struct {
OVERLAPPED ovl;
IOEVENTTYPE eventType;
HANDLE fd;
HANDLE childFd; // accepted socket
bool bSocket;
UINT id;
void* data;
DWORD dataLen; // changed to bytes transferred after event is fired
void* callback;
} IOLISTENER;
typedef struct {
OVERLAPPED ovl;
IOEVENTTYPE eventType;
HANDLE fd;
HANDLE childFd; // accepted socket
bool bSocket;
UINT id;
void* data;
DWORD dataLen; // changed to bytes transferred after event is fired
void* callback;
} IOLISTENER;
// Wrapper for file/socket descriptor and completion port
typedef struct {
HANDLE fd;
HANDLE iocp;
bool bSocket;
} IOFD;
typedef enum {
EVENT_STATUS_OK,
EVENT_STATUS_INTERRUPTED,
EVENT_STATUS_ERROR
} EVENT_STATUS;
// Wrapper for file/socket descriptor and completion port
typedef struct {
HANDLE fd;
HANDLE iocp;
bool bSocket;
} IOFD;
typedef enum {
EVENT_STATUS_OK,
EVENT_STATUS_INTERRUPTED,
EVENT_STATUS_ERROR
} EVENT_STATUS;
public:
CScriptInstance(CDebuggerUI* debugger);
~CScriptInstance();
void Start(char* path);
void ForceStop();
void Invoke(void* heapptr, uint32_t param = 0);
INSTANCE_STATE GetState();
CScriptInstance(CDebuggerUI* debugger);
~CScriptInstance();
friend class PendingEval;
void EvalAsync(const char* jsCode);
const char* Eval(const char* jsCode);
void Start(char* path);
void ForceStop();
void Invoke(void* heapptr, uint32_t param = 0);
INSTANCE_STATE GetState();
friend class PendingEval;
void EvalAsync(const char* jsCode);
const char* Eval(const char* jsCode);
private:
duk_context* m_Ctx;
duk_context* DukContext();
char* m_TempPath;
HANDLE m_hThread;
HANDLE m_hIOCompletionPort;
CRITICAL_SECTION m_CriticalSection;
duk_context* m_Ctx;
duk_context* DukContext();
char* m_TempPath;
vector<IOFD> m_Files;
vector<IOLISTENER*> m_Listeners;
UINT m_NextListenerId;
CDebuggerUI* m_Debugger;
HANDLE m_hThread;
HANDLE m_hIOCompletionPort;
CRITICAL_SECTION m_CriticalSection;
CScriptSystem* m_ScriptSystem;
vector<IOFD> m_Files;
vector<IOLISTENER*> m_Listeners;
UINT m_NextListenerId;
INSTANCE_STATE m_State;
static DWORD CALLBACK StartThread(CScriptInstance* _this);
void StartScriptProc();
void StartEventLoop();
bool HaveEvents();
EVENT_STATUS WaitForEvent(IOLISTENER** lpListener);
CDebuggerUI* m_Debugger;
void SetState(INSTANCE_STATE state);
void StateChanged();
CScriptSystem* m_ScriptSystem;
void QueueAPC(PAPCFUNC userProc, ULONG_PTR param = 0);
INSTANCE_STATE m_State;
void AddFile(HANDLE fd, bool bSocket = false);
void CloseFile(HANDLE fd);
void CloseAllFiles();
void RemoveFile(HANDLE fd);
HANDLE CreateSocket();
IOLISTENER* AddListener(HANDLE fd, IOEVENTTYPE evt, void* jsCallback, void* data = NULL, int dataLen = 0);
void RemoveListener(IOLISTENER* lpListener);
void RemoveListenerByIndex(UINT index);
void RemoveListenersByFd(HANDLE fd);
void InvokeListenerCallback(IOLISTENER* lpListener);
static void CALLBACK EvalAsyncCallback(ULONG_PTR evalWait);
static DWORD CALLBACK StartThread(CScriptInstance* _this);
void StartScriptProc();
void StartEventLoop();
bool HaveEvents();
EVENT_STATUS WaitForEvent(IOLISTENER** lpListener);
const char* EvalFile(const char* jsPath);
// Lookup list of CScriptInstance instances for static js_* functions
static vector<CScriptInstance*> Cache;
static void CacheInstance(CScriptInstance* _this);
static void UncacheInstance(CScriptInstance* _this);
static CScriptInstance* FetchInstance(duk_context* ctx);
// Bound functions (_native object)
static duk_ret_t js_ioSockCreate (duk_context*);
static duk_ret_t js_ioSockListen (duk_context*);
static duk_ret_t js_ioSockAccept (duk_context*); // async
static duk_ret_t js_ioSockConnect (duk_context*); // async
static duk_ret_t js_ioRead (duk_context*); // async
static duk_ret_t js_ioWrite (duk_context*); // async
static duk_ret_t js_ioClose (duk_context*); // (fd) ; file or socket
static duk_ret_t js_MsgBox (duk_context*); // (message, caption)
static duk_ret_t js_AddCallback (duk_context*); // (hookId, callback, tag) ; external events
static duk_ret_t js_RemoveCallback (duk_context*); // (callbackId)
static duk_ret_t js_GetPCVal (duk_context*); // ()
static duk_ret_t js_SetPCVal (duk_context*); // (value)
static duk_ret_t js_GetHIVal (duk_context*); // (bUpper)
static duk_ret_t js_SetHIVal (duk_context*); // (bUpper, value)
static duk_ret_t js_GetLOVal (duk_context*); // (bUpper)
static duk_ret_t js_SetLOVal (duk_context*); // (bUpper, value)
static duk_ret_t js_GetGPRVal (duk_context*); // (regNum, bUpper)
static duk_ret_t js_SetGPRVal (duk_context*); // (regNum, bUpper, value)
static duk_ret_t js_GetFPRVal (duk_context*); // (regNum, bDouble)
static duk_ret_t js_SetFPRVal (duk_context*); // (regNum, bDouble, value)
static duk_ret_t js_GetROMInt (duk_context*); // (address, bitwidth, signed)
static duk_ret_t js_GetROMFloat (duk_context*); // (address, bDouble)
static duk_ret_t js_GetROMBlock (duk_context*); // (address, nBytes) ; returns Buffer
static duk_ret_t js_GetROMString (duk_context*); // (address[, maxLen]) ; fetch zero terminated string from memory
void SetState(INSTANCE_STATE state);
void StateChanged();
static duk_ret_t js_GetRDRAMInt (duk_context*); // (address, bitwidth, signed)
static duk_ret_t js_SetRDRAMInt (duk_context*); // (address, bitwidth, signed, newValue)
static duk_ret_t js_GetRDRAMFloat (duk_context*); // (address, bDouble)
static duk_ret_t js_SetRDRAMFloat (duk_context*); // (address, bDouble, newValue)
static duk_ret_t js_GetRDRAMBlock (duk_context*); // (address, nBytes) ; returns Buffer
static duk_ret_t js_GetRDRAMString (duk_context*); // (address[, maxLen]) ; fetch zero terminated string from memory
static duk_ret_t js_ConsolePrint (duk_context*);
static duk_ret_t js_ConsoleClear (duk_context*);
void QueueAPC(PAPCFUNC userProc, ULONG_PTR param = 0);
static duk_ret_t js_Pause(duk_context*); // () ; pauses emulation
static duk_ret_t js_ShowCommands(duk_context*); // ([address]) ; shows commands window
void AddFile(HANDLE fd, bool bSocket = false);
void CloseFile(HANDLE fd);
void CloseAllFiles();
void RemoveFile(HANDLE fd);
HANDLE CreateSocket();
static duk_ret_t js_ScreenPrint(duk_context*); // (x, y, text)
IOLISTENER* AddListener(HANDLE fd, IOEVENTTYPE evt, void* jsCallback, void* data = NULL, int dataLen = 0);
void RemoveListener(IOLISTENER* lpListener);
void RemoveListenerByIndex(UINT index);
void RemoveListenersByFd(HANDLE fd);
void InvokeListenerCallback(IOLISTENER* lpListener);
static constexpr duk_function_list_entry NativeFunctions[] =
{
{ "addCallback", js_AddCallback, DUK_VARARGS },
{ "removeCallback", js_RemoveCallback, DUK_VARARGS },
static void CALLBACK EvalAsyncCallback(ULONG_PTR evalWait);
{ "setPCVal", js_SetPCVal, DUK_VARARGS },
{ "getPCVal", js_GetPCVal, DUK_VARARGS },
{ "setHIVal", js_SetHIVal, DUK_VARARGS },
{ "getHIVal", js_GetHIVal, DUK_VARARGS },
{ "setLOVal", js_SetLOVal, DUK_VARARGS },
{ "getLOVal", js_GetLOVal, DUK_VARARGS },
{ "setGPRVal", js_SetGPRVal, DUK_VARARGS },
{ "getGPRVal", js_GetGPRVal, DUK_VARARGS },
{ "setFPRVal", js_SetFPRVal, DUK_VARARGS },
{ "getFPRVal", js_GetFPRVal, DUK_VARARGS },
const char* EvalFile(const char* jsPath);
{ "getROMInt", js_GetROMInt, DUK_VARARGS },
{ "getROMFloat", js_GetROMFloat, DUK_VARARGS },
{ "getROMString", js_GetROMString, DUK_VARARGS },
{ "getROMBlock", js_GetROMBlock, DUK_VARARGS },
// Lookup list of CScriptInstance instances for static js_* functions
static vector<CScriptInstance*> Cache;
static void CacheInstance(CScriptInstance* _this);
static void UncacheInstance(CScriptInstance* _this);
static CScriptInstance* FetchInstance(duk_context* ctx);
{ "getRDRAMInt", js_GetRDRAMInt, DUK_VARARGS },
{ "setRDRAMInt", js_SetRDRAMInt, DUK_VARARGS },
{ "getRDRAMFloat", js_GetRDRAMFloat, DUK_VARARGS },
{ "setRDRAMFloat", js_SetRDRAMFloat, DUK_VARARGS },
{ "getRDRAMBlock", js_GetRDRAMBlock, DUK_VARARGS },
{ "getRDRAMString", js_GetRDRAMString, DUK_VARARGS },
// Bound functions (_native object)
static duk_ret_t js_ioSockCreate(duk_context*);
static duk_ret_t js_ioSockListen(duk_context*);
static duk_ret_t js_ioSockAccept(duk_context*); // async
static duk_ret_t js_ioSockConnect(duk_context*); // async
static duk_ret_t js_ioRead(duk_context*); // async
static duk_ret_t js_ioWrite(duk_context*); // async
static duk_ret_t js_ioClose(duk_context*); // (fd) ; file or socket
static duk_ret_t js_MsgBox(duk_context*); // (message, caption)
static duk_ret_t js_AddCallback(duk_context*); // (hookId, callback, tag) ; external events
static duk_ret_t js_RemoveCallback(duk_context*); // (callbackId)
static duk_ret_t js_GetPCVal(duk_context*); // ()
static duk_ret_t js_SetPCVal(duk_context*); // (value)
static duk_ret_t js_GetHIVal(duk_context*); // (bUpper)
static duk_ret_t js_SetHIVal(duk_context*); // (bUpper, value)
static duk_ret_t js_GetLOVal(duk_context*); // (bUpper)
static duk_ret_t js_SetLOVal(duk_context*); // (bUpper, value)
static duk_ret_t js_GetGPRVal(duk_context*); // (regNum, bUpper)
static duk_ret_t js_SetGPRVal(duk_context*); // (regNum, bUpper, value)
static duk_ret_t js_GetFPRVal(duk_context*); // (regNum, bDouble)
static duk_ret_t js_SetFPRVal(duk_context*); // (regNum, bDouble, value)
static duk_ret_t js_GetROMInt(duk_context*); // (address, bitwidth, signed)
static duk_ret_t js_GetROMFloat(duk_context*); // (address, bDouble)
static duk_ret_t js_GetROMBlock(duk_context*); // (address, nBytes) ; returns Buffer
static duk_ret_t js_GetROMString(duk_context*); // (address[, maxLen]) ; fetch zero terminated string from memory
{ "sockCreate", js_ioSockCreate, DUK_VARARGS },
{ "sockListen", js_ioSockListen, DUK_VARARGS },
{ "sockAccept", js_ioSockAccept, DUK_VARARGS },
{ "sockConnect", js_ioSockConnect, DUK_VARARGS },
{ "close", js_ioClose, DUK_VARARGS },
{ "write", js_ioWrite, DUK_VARARGS },
{ "read", js_ioRead, DUK_VARARGS },
{ "msgBox", js_MsgBox, DUK_VARARGS },
{ "consolePrint", js_ConsolePrint, DUK_VARARGS },
{ "consoleClear", js_ConsoleClear, DUK_VARARGS },
{ "pause", js_Pause, DUK_VARARGS },
{ "showCommands", js_ShowCommands, DUK_VARARGS },
static duk_ret_t js_GetRDRAMInt(duk_context*); // (address, bitwidth, signed)
static duk_ret_t js_SetRDRAMInt(duk_context*); // (address, bitwidth, signed, newValue)
static duk_ret_t js_GetRDRAMFloat(duk_context*); // (address, bDouble)
static duk_ret_t js_SetRDRAMFloat(duk_context*); // (address, bDouble, newValue)
static duk_ret_t js_GetRDRAMBlock(duk_context*); // (address, nBytes) ; returns Buffer
static duk_ret_t js_GetRDRAMString(duk_context*); // (address[, maxLen]) ; fetch zero terminated string from memory
static duk_ret_t js_ConsolePrint(duk_context*);
static duk_ret_t js_ConsoleClear(duk_context*);
{ "screenPrint", js_ScreenPrint, DUK_VARARGS },
{ NULL, NULL, 0 }
};
static duk_ret_t js_Pause(duk_context*); // () ; pauses emulation
static duk_ret_t js_ShowCommands(duk_context*); // ([address]) ; shows commands window
static duk_ret_t js_ScreenPrint(duk_context*); // (x, y, text)
static constexpr duk_function_list_entry NativeFunctions[] =
{
{ "addCallback", js_AddCallback, DUK_VARARGS },
{ "removeCallback", js_RemoveCallback, DUK_VARARGS },
{ "setPCVal", js_SetPCVal, DUK_VARARGS },
{ "getPCVal", js_GetPCVal, DUK_VARARGS },
{ "setHIVal", js_SetHIVal, DUK_VARARGS },
{ "getHIVal", js_GetHIVal, DUK_VARARGS },
{ "setLOVal", js_SetLOVal, DUK_VARARGS },
{ "getLOVal", js_GetLOVal, DUK_VARARGS },
{ "setGPRVal", js_SetGPRVal, DUK_VARARGS },
{ "getGPRVal", js_GetGPRVal, DUK_VARARGS },
{ "setFPRVal", js_SetFPRVal, DUK_VARARGS },
{ "getFPRVal", js_GetFPRVal, DUK_VARARGS },
{ "getROMInt", js_GetROMInt, DUK_VARARGS },
{ "getROMFloat", js_GetROMFloat, DUK_VARARGS },
{ "getROMString", js_GetROMString, DUK_VARARGS },
{ "getROMBlock", js_GetROMBlock, DUK_VARARGS },
{ "getRDRAMInt", js_GetRDRAMInt, DUK_VARARGS },
{ "setRDRAMInt", js_SetRDRAMInt, DUK_VARARGS },
{ "getRDRAMFloat", js_GetRDRAMFloat, DUK_VARARGS },
{ "setRDRAMFloat", js_SetRDRAMFloat, DUK_VARARGS },
{ "getRDRAMBlock", js_GetRDRAMBlock, DUK_VARARGS },
{ "getRDRAMString", js_GetRDRAMString, DUK_VARARGS },
{ "sockCreate", js_ioSockCreate, DUK_VARARGS },
{ "sockListen", js_ioSockListen, DUK_VARARGS },
{ "sockAccept", js_ioSockAccept, DUK_VARARGS },
{ "sockConnect", js_ioSockConnect, DUK_VARARGS },
{ "close", js_ioClose, DUK_VARARGS },
{ "write", js_ioWrite, DUK_VARARGS },
{ "read", js_ioRead, DUK_VARARGS },
{ "msgBox", js_MsgBox, DUK_VARARGS },
{ "consolePrint", js_ConsolePrint, DUK_VARARGS },
{ "consoleClear", js_ConsoleClear, DUK_VARARGS },
{ "pause", js_Pause, DUK_VARARGS },
{ "showCommands", js_ShowCommands, DUK_VARARGS },
{ "screenPrint", js_ScreenPrint, DUK_VARARGS },
{ NULL, NULL, 0 }
};
};

View File

@ -21,108 +21,107 @@ class CScriptHook;
class CScriptSystem
{
public:
CScriptSystem(CDebuggerUI* debugger);
~CScriptSystem();
// Run a script in its own context/thread
void RunScript(char* path);
CScriptSystem(CDebuggerUI* debugger);
~CScriptSystem();
// Run a script in its own context/thread
void RunScript(char* path);
// Kill a script context/thread by its path
void StopScript(char* path);
// Kill a script context/thread by its path
void StopScript(char* path);
const char* APIScript();
const char* APIScript();
private:
typedef struct {
const char* hookId;
CScriptHook* cbList;
} HOOKENTRY;
typedef struct {
const char* hookId;
CScriptHook* cbList;
} HOOKENTRY;
typedef struct {
char* path;
CScriptInstance* scriptInstance;
} INSTANCE_ENTRY;
typedef struct {
char* path;
CScriptInstance* scriptInstance;
} INSTANCE_ENTRY;
CDebuggerUI* m_Debugger;
CDebuggerUI* m_Debugger;
char* m_APIScript;
char* m_APIScript;
vector<HOOKENTRY> m_Hooks;
vector<INSTANCE_ENTRY> m_RunningInstances;
vector<HOOKENTRY> m_Hooks;
vector<INSTANCE_ENTRY> m_RunningInstances;
vector<char*> m_LogData;
vector<char*> m_LogData;
CScriptHook* m_HookCPUExec;
CScriptHook* m_HookCPURead;
CScriptHook* m_HookCPUWrite;
CScriptHook* m_HookCPUExec;
CScriptHook* m_HookCPURead;
CScriptHook* m_HookCPUWrite;
CScriptHook* m_HookFrameDrawn;
CScriptHook* m_HookFrameDrawn;
void RegisterHook(const char* hookId, CScriptHook* cbList); // associate string id with callback list
void UnregisterHooks();
void RegisterHook(const char* hookId, CScriptHook* cbList); // associate string id with callback list
void UnregisterHooks();
HDC m_ScreenDC;
HDC m_ScreenDC;
int m_NextCallbackId;
int m_NextCallbackId;
public:
// Returns true if any of the script hooks have callbacks for scriptInstance
// Returns true if any of the script hooks have callbacks for scriptInstance
void SetScreenDC(HDC hdc)
{
m_ScreenDC = hdc;
}
void SetScreenDC(HDC hdc)
{
m_ScreenDC = hdc;
}
HDC GetScreenDC()
{
return m_ScreenDC;
}
HDC GetScreenDC()
{
return m_ScreenDC;
}
inline vector<char*>* LogData()
{
return &m_LogData;
}
inline vector<char*>* LogData()
{
return &m_LogData;
}
inline void LogText(const char* text)
{
char* newStr = (char*)malloc(strlen(text));
strcpy(newStr, text);
m_LogData.push_back(newStr);
m_Debugger->Debug_RefreshScriptsWindow();
}
bool HasCallbacksForInstance(CScriptInstance* scriptInstance);
inline void LogText(const char* text)
{
char* newStr = (char*)malloc(strlen(text));
strcpy(newStr, text);
m_LogData.push_back(newStr);
m_Debugger->Debug_RefreshScriptsWindow();
}
// Remove all hooked callbacks for an instance
void ClearCallbacksForInstance(CScriptInstance* scriptInstance);
bool HasCallbacksForInstance(CScriptInstance* scriptInstance);
void RemoveCallbackById(int callbackId);
// Remove all hooked callbacks for an instance
void ClearCallbacksForInstance(CScriptInstance* scriptInstance);
CScriptHook* GetHook(const char* hookId);
void RemoveCallbackById(int callbackId);
int GetNextCallbackId();
void DeleteStoppedInstances();
INSTANCE_STATE GetInstanceState(char* scriptName);
CScriptInstance* GetInstance(char* scriptName);
CScriptHook* GetHook(const char* hookId);
CScriptHook* HookCPUExec()
{
return m_HookCPUExec;
}
int GetNextCallbackId();
CScriptHook* HookCPURead()
{
return m_HookCPURead;
}
void DeleteStoppedInstances();
INSTANCE_STATE GetInstanceState(char* scriptName);
CScriptInstance* GetInstance(char* scriptName);
CScriptHook* HookCPUWrite()
{
return m_HookCPUWrite;
}
CScriptHook* HookCPUExec()
{
return m_HookCPUExec;
}
CScriptHook* HookFrameDrawn()
{
return m_HookFrameDrawn;
}
CScriptHook* HookCPURead()
{
return m_HookCPURead;
}
CScriptHook* HookCPUWrite()
{
return m_HookCPUWrite;
}
CScriptHook* HookFrameDrawn()
{
return m_HookFrameDrawn;
}
};

View File

@ -6,154 +6,153 @@ class CSymbolEntry;
class CSymbols
{
public:
typedef enum {
ERR_SUCCESS,
ERR_INVALID_TYPE,
ERR_INVALID_ADDR,
ERR_INVALID_NAME,
ERR_MISSING_FIELDS,
} ParseError;
typedef enum {
ERR_SUCCESS,
ERR_INVALID_TYPE,
ERR_INVALID_ADDR,
ERR_INVALID_NAME,
ERR_MISSING_FIELDS,
} ParseError;
typedef enum {
TYPE_CODE,
TYPE_DATA,
TYPE_U8,
TYPE_U16,
TYPE_U32,
TYPE_U64,
TYPE_S8,
TYPE_S16,
TYPE_S32,
TYPE_S64,
TYPE_FLOAT,
TYPE_DOUBLE
} DataType;
typedef enum {
TYPE_CODE,
TYPE_DATA,
TYPE_U8,
TYPE_U16,
TYPE_U32,
TYPE_U64,
TYPE_S8,
TYPE_S16,
TYPE_S32,
TYPE_S64,
TYPE_FLOAT,
TYPE_DOUBLE
} DataType;
static constexpr char* SymbolTypes[] = {
"code", // 0
"data", // 1
"u8",
"u16",
"u32",
"u64",
"s8",
"s16",
"s32",
"s64",
"float",
"double",
NULL
};
static constexpr char* SymbolTypes[] = {
"code", // 0
"data", // 1
"u8",
"u16",
"u32",
"u64",
"s8",
"s16",
"s32",
"s64",
"float",
"double",
NULL
};
static constexpr int TypeSizes[] = {
1, 1, // code data
1, 2, 4, 8, // u8 u16 u32 u64
1, 2, 4, 8, // s8 s16 s32 s64
4, 8 // float double
};
static constexpr int TypeSizes[] = {
1, 1, // code data
1, 2, 4, 8, // u8 u16 u32 u64
1, 2, 4, 8, // s8 s16 s32 s64
4, 8 // float double
};
private:
static bool m_bInitialized;
static vector<CSymbolEntry*> m_Symbols;
static int m_NextSymbolId;
static CFile m_SymFileHandle;
static char* m_SymFileBuffer;
static size_t m_SymFileSize;
static bool m_bInitialized;
static vector<CSymbolEntry*> m_Symbols;
static int m_NextSymbolId;
static CRITICAL_SECTION m_CriticalSection;
static CFile m_SymFileHandle;
static char* m_SymFileBuffer;
static size_t m_SymFileSize;
static char* m_ParserToken;
static size_t m_ParserTokenLength;
static char m_ParserDelimeter;
static char* m_SymFileParseBuffer;
static bool m_bHaveFirstToken;
static CRITICAL_SECTION m_CriticalSection;
static void ParserInit();
static void ParserDone();
static void ParserFetchToken(const char* delim);
static char* m_ParserToken;
static size_t m_ParserTokenLength;
static char m_ParserDelimeter;
static char* m_SymFileParseBuffer;
static bool m_bHaveFirstToken;
static void ParserInit();
static void ParserDone();
static void ParserFetchToken(const char* delim);
static bool SortFunction(CSymbolEntry* a, CSymbolEntry* b);
static bool SortFunction(CSymbolEntry* a, CSymbolEntry* b);
public:
static CPath GetSymFilePath();
static void Load();
static void Save();
static void ParseErrorAlert(char* message, int lineNumber);
static void Add(int type, uint32_t address, char* name, char* description = NULL);
static void RemoveEntryById(int id);
static void Reset();
static CPath GetSymFilePath();
static void Load();
static void Save();
static void ParseErrorAlert(char* message, int lineNumber);
static const char* GetTypeName(int typeNumber);
static int GetTypeNumber(char* typeName);
static void GetValueString(char* str, CSymbolEntry* lpSymbol);
static void Add(int type, uint32_t address, char* name, char* description = NULL);
static void RemoveEntryById(int id);
static int GetCount();
static void Reset();
static CSymbolEntry* GetEntryById(int id);
static CSymbolEntry* GetEntryByIndex(int id);
static CSymbolEntry* GetEntryByAddress(uint32_t address);
static const char* GetTypeName(int typeNumber);
static int GetTypeNumber(char* typeName);
static void GetValueString(char* str, CSymbolEntry* lpSymbol);
static const char* GetNameByAddress(uint32_t address);
static int GetCount();
static void InitializeCriticalSection();
static void DeleteCriticalSection();
static void EnterCriticalSection();
static void LeaveCriticalSection();
static CSymbolEntry* GetEntryById(int id);
static CSymbolEntry* GetEntryByIndex(int id);
static CSymbolEntry* GetEntryByAddress(uint32_t address);
static const char* GetNameByAddress(uint32_t address);
static void InitializeCriticalSection();
static void DeleteCriticalSection();
static void EnterCriticalSection();
static void LeaveCriticalSection();
};
class CSymbolEntry {
public:
int m_Id;
int m_Type;
uint32_t m_Address;
char* m_Name;
char* m_Description;
CSymbolEntry(int id, int type, uint32_t address, char* name, char* description) :
m_Name(NULL),
m_Description(NULL),
m_Id(id),
m_Type(type),
m_Address(address)
{
if (name != NULL)
{
size_t nameLen = strlen(name);
m_Name = (char*)malloc(nameLen + 1);
strcpy(m_Name, name);
}
int m_Id;
int m_Type;
uint32_t m_Address;
char* m_Name;
char* m_Description;
if (description != NULL)
{
size_t descLen = strlen(description);
m_Description = (char*)malloc(descLen + 1);
strcpy(m_Description, description);
}
}
~CSymbolEntry()
{
if (m_Name != NULL)
{
free(m_Name);
}
if (m_Description != NULL)
{
free(m_Description);
}
}
CSymbolEntry(int id, int type, uint32_t address, char* name, char* description) :
m_Name(NULL),
m_Description(NULL),
m_Id(id),
m_Type(type),
m_Address(address)
{
if (name != NULL)
{
size_t nameLen = strlen(name);
m_Name = (char*)malloc(nameLen + 1);
strcpy(m_Name, name);
}
const char* TypeName()
{
return CSymbols::SymbolTypes[m_Type];
}
if (description != NULL)
{
size_t descLen = strlen(description);
m_Description = (char*)malloc(descLen + 1);
strcpy(m_Description, description);
}
}
int TypeSize()
{
return CSymbols::TypeSizes[m_Type];
}
~CSymbolEntry()
{
if (m_Name != NULL)
{
free(m_Name);
}
if (m_Description != NULL)
{
free(m_Description);
}
}
const char* TypeName()
{
return CSymbols::SymbolTypes[m_Type];
}
int TypeSize()
{
return CSymbols::TypeSizes[m_Type];
}
};

View File

@ -27,68 +27,68 @@ class CScriptSystem;
__interface CDebugger
{
virtual void TLBChanged ( void ) = 0;
virtual bool CPUStepStarted ( void ) = 0;
virtual void CPUStep ( void ) = 0;
virtual void FrameDrawn ( void ) = 0;
virtual void TLBChanged(void) = 0;
virtual bool CPUStepStarted(void) = 0;
virtual void CPUStep(void) = 0;
virtual void FrameDrawn(void) = 0;
};
class CDebuggerUI :
public CDebugger
public CDebugger
{
CDumpMemory * m_MemoryDump;
CDebugMemoryView * m_MemoryView;
CDebugMemorySearch * m_MemorySearch;
CDebugTlb * m_DebugTLB;
CDebugCommandsView * m_CommandsView;
CDebugScripts * m_Scripts;
CDebugSymbols * m_Symbols;
CDebugDMALogView * m_DMALogView;
CDebugStackTrace * m_StackTrace;
CDebugStackView * m_StackView;
CDebugCommandsView * m_CommandsView;
CDebugScripts * m_Scripts;
CDebugSymbols * m_Symbols;
CDebugDMALogView * m_DMALogView;
CDebugStackTrace * m_StackTrace;
CDebugStackView * m_StackView;
CBreakpoints * m_Breakpoints;
CScriptSystem * m_ScriptSystem;
CDMALog * m_DMALog;
CBreakpoints * m_Breakpoints;
CScriptSystem * m_ScriptSystem;
CDMALog * m_DMALog;
void BreakpointHit(void);
void BreakpointHit(void);
protected:
CDebuggerUI();
virtual ~CDebuggerUI();
void TLBChanged ( void );
bool CPUStepStarted ( void );
void CPUStep ( void );
void FrameDrawn ( void );
void TLBChanged(void);
bool CPUStepStarted(void);
void CPUStep(void);
void FrameDrawn(void);
public:
void Debug_Reset ( void );
void Debug_ShowMemoryDump ( void );
void Debug_ShowMemoryWindow ( void );
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
void Debug_ShowMemorySearch ( void );
void Debug_ShowTLBWindow ( void );
void Debug_RefreshTLBWindow ( void );
void Debug_ShowCommandsWindow ( void );
void Debug_ShowCommandsLocation ( uint32_t address, bool top );
void Debug_ShowScriptsWindow ( void );
void Debug_LogScriptsWindow ( const char* text );
void Debug_ClearScriptsWindow ( void );
void Debug_RefreshScriptsWindow ( void );
void Debug_RefreshSymbolsWindow ( void );
void Debug_ShowSymbolsWindow ( void );
void Debug_ShowStackTrace ( void );
void Debug_ShowStackWindow ( void );
void Debug_RefreshStackWindow ( void );
void Debug_RefreshStackTraceWindow ( void );
void Debug_ShowDMALogWindow ( void );
void Debug_Reset(void);
void Debug_ShowMemoryDump(void);
void Debug_ShowMemoryWindow(void);
void Debug_ShowMemoryLocation(uint32_t Address, bool VAddr);
void Debug_ShowMemorySearch(void);
void Debug_ShowTLBWindow(void);
void Debug_RefreshTLBWindow(void);
void Debug_ShowCommandsWindow(void);
void Debug_ShowCommandsLocation(uint32_t address, bool top);
void Debug_ShowScriptsWindow(void);
void Debug_LogScriptsWindow(const char* text);
void Debug_ClearScriptsWindow(void);
void Debug_RefreshScriptsWindow(void);
void Debug_RefreshSymbolsWindow(void);
void Debug_ShowSymbolsWindow(void);
void Debug_ShowStackTrace(void);
void Debug_ShowStackWindow(void);
void Debug_RefreshStackWindow(void);
void Debug_RefreshStackTraceWindow(void);
void Debug_ShowDMALogWindow(void);
CBreakpoints* Breakpoints();
CDebugSymbols* Symbols();
CScriptSystem* ScriptSystem();
CDebugScripts* ScriptConsole();
CDMALog* DMALog();
CBreakpoints* Breakpoints();
CDebugSymbols* Symbols();
CScriptSystem* ScriptSystem();
CDebugScripts* ScriptConsole();
CDMALog* DMALog();
static void GameReset ( CDebuggerUI * _this );
static void GameReset(CDebuggerUI * _this);
};