2017-08-18 05:08:22 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include "Breakpoints.h"
|
2020-04-09 05:39:31 +00:00
|
|
|
#include "Debugger-RegisterTabData.h"
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-01-15 21:14:15 +00:00
|
|
|
class CEditReg64 :
|
|
|
|
public CWindowImpl<CEditReg64, CEdit>,
|
|
|
|
private CDebugSettings
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-09-13 10:36:03 +00:00
|
|
|
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();
|
2020-04-09 05:39:31 +00:00
|
|
|
stdstr GetValueText();
|
2017-09-13 10:36:03 +00:00
|
|
|
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)
|
2017-12-12 10:15:34 +00:00
|
|
|
END_MSG_MAP()
|
2017-08-18 05:08:22 +00:00
|
|
|
};
|
|
|
|
|
2018-01-15 21:14:15 +00:00
|
|
|
class CRegisterTabs :
|
|
|
|
public CTabCtrl,
|
|
|
|
public CDebugSettings
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2018-03-01 07:12:16 +00:00
|
|
|
enum TAB_ID
|
|
|
|
{
|
|
|
|
TabDefault,
|
|
|
|
TabGPR,
|
|
|
|
TabFPR
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
CRegisterTabs(void);
|
|
|
|
~CRegisterTabs();
|
|
|
|
|
2019-06-15 11:04:37 +00:00
|
|
|
void Attach(HWND hWndNew, CDebuggerUI* debugger);
|
2018-03-01 07:12:16 +00:00
|
|
|
HWND Detach();
|
|
|
|
|
|
|
|
CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc);
|
|
|
|
void ShowTab(int nPage);
|
|
|
|
CRect GetPageRect();
|
|
|
|
void RedrawCurrentTab();
|
|
|
|
void RefreshEdits();
|
|
|
|
void SetColorsEnabled(bool bColorsEnabled);
|
2020-04-09 05:39:31 +00:00
|
|
|
void CopyTabRegisters();
|
|
|
|
void CopyAllRegisters();
|
2018-03-01 07:12:16 +00:00
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
private:
|
2018-03-01 07:12:16 +00:00
|
|
|
CRegisterTabs(const CRegisterTabs&); // Disable copy constructor
|
|
|
|
CRegisterTabs& operator=(const CRegisterTabs&); // Disable assignment
|
|
|
|
|
2020-04-09 05:39:31 +00:00
|
|
|
stdstr CopyTabRegisters(int id);
|
|
|
|
|
2018-03-01 07:12:16 +00:00
|
|
|
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);
|
|
|
|
|
2020-04-09 05:39:31 +00:00
|
|
|
|
|
|
|
static void InitRegisterEdit(CWindow& tab, CEditNumber32& edit, FieldPair ctrl);
|
|
|
|
static void InitRegisterEdits(CWindow& tab, CEditNumber32* edits, const TabRecord* ctrlIds);
|
|
|
|
static void InitRegisterEdit64(CWindow& tab, CEditReg64& edit, FieldPair ctrl);
|
|
|
|
static void InitRegisterEdits64(CWindow& tab, CEditReg64* edits, const TabRecord* ctrlIds);
|
|
|
|
|
2018-03-01 07:12:16 +00:00
|
|
|
static void ZeroRegisterEdit(CEditNumber32& edit);
|
|
|
|
static void ZeroRegisterEdits(CEditNumber32* edits, uint32_t ctrlIdsCount);
|
|
|
|
static void ZeroRegisterEdit64(CEditReg64& edit);
|
|
|
|
static void ZeroRegisterEdits64(CEditReg64* edits, uint32_t ctrlIdsCount);
|
|
|
|
|
2017-09-13 10:36:03 +00:00
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
uint32_t intval;
|
|
|
|
|
2017-11-10 05:46:03 +00:00
|
|
|
struct
|
|
|
|
{
|
2017-09-13 10:36:03 +00:00
|
|
|
unsigned : 2;
|
|
|
|
unsigned exceptionCode : 5;
|
|
|
|
unsigned : 1;
|
|
|
|
unsigned pendingInterrupts : 8;
|
|
|
|
unsigned : 12;
|
|
|
|
unsigned coprocessor : 2;
|
|
|
|
unsigned : 1;
|
|
|
|
unsigned fromDelaySlot : 1;
|
|
|
|
};
|
|
|
|
} CAUSE;
|
|
|
|
|
2020-04-09 05:39:31 +00:00
|
|
|
static constexpr FieldPair GPRHi = {IDC_HI_LBL, IDC_HI_EDIT};
|
|
|
|
static constexpr FieldPair GPRLo = {IDC_LO_LBL, IDC_LO_EDIT};
|
2017-09-13 10:36:03 +00:00
|
|
|
|
2020-04-09 05:39:31 +00:00
|
|
|
static constexpr FieldPair FPRFCSR = {IDC_FCSR_LBL, IDC_FCSR_EDIT};
|
2017-09-13 10:36:03 +00:00
|
|
|
|
2020-04-09 05:39:31 +00:00
|
|
|
static constexpr FieldPair SPPC = {IDC_SP_PC_LBL, IDC_SP_PC_EDIT};
|
2017-09-13 10:36:03 +00:00
|
|
|
|
2017-12-12 10:15:34 +00:00
|
|
|
static constexpr char* ExceptionCodes[] =
|
|
|
|
{
|
2017-09-13 10:36:03 +00:00
|
|
|
"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;
|
2019-01-20 08:52:49 +00:00
|
|
|
static CDebuggerUI* m_Debugger;
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
vector<CWindow> m_TabWindows;
|
2018-03-02 06:34:27 +00:00
|
|
|
bool m_attached;
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_GPRTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditReg64 m_GPREdits[TabData::GPR.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
CEditReg64 m_HIEdit;
|
|
|
|
CEditReg64 m_LOEdit;
|
|
|
|
|
|
|
|
CWindow m_FPRTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_FPREdits[TabData::FPR.FieldCount];
|
2017-11-21 20:37:45 +00:00
|
|
|
CEditNumber32 m_FCSREdit;
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_COP0Tab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_COP0Edits[TabData::COP0.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
CStatic m_CauseTip;
|
|
|
|
|
|
|
|
CWindow m_RDRAMTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_RDRAMEdits[TabData::RDRAM.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_SPTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_SPEdits[TabData::SP.FieldCount];
|
2017-11-21 20:37:45 +00:00
|
|
|
CEditNumber32 m_SPPCEdit;
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_DPCTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_DPCEdits[TabData::DPC.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_MITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_MIEdits[TabData::MI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_VITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_VIEdits[TabData::VI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_AITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_AIEdits[TabData::AI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_PITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_PIEdits[TabData::PI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_RITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_RIEdits[TabData::RI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_SITab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_SIEdits[TabData::SI.FieldCount];
|
2017-09-13 10:36:03 +00:00
|
|
|
|
|
|
|
CWindow m_DDTab;
|
2020-04-09 05:39:31 +00:00
|
|
|
CEditNumber32 m_DDEdits[TabData::DD.FieldCount];
|
2017-08-18 05:08:22 +00:00
|
|
|
};
|