Merge pull request #1602 from shygoo/fix-dmalog
[Debugger] Make DMA log stable
This commit is contained in:
commit
b486f8d587
|
@ -100,12 +100,16 @@ void CDebugDMALogView::RefreshList()
|
|||
m_DMAList.AddItem(itemIndex, 1, stdstr_f("%08X", lpEntry->ramAddr).c_str());
|
||||
m_DMAList.AddItem(itemIndex, 2, stdstr_f("%08X (%d)", lpEntry->length, lpEntry->length).c_str());
|
||||
|
||||
uint32_t sig = *(uint32_t*)&rom[lpEntry->romAddr];
|
||||
sig = _byteswap_ulong(sig);
|
||||
char sigc[5];
|
||||
memset(sigc, 0, sizeof(sigc));
|
||||
|
||||
char sigc[5];
|
||||
memcpy(sigc, &sig, 4);
|
||||
sigc[4] = '\0';
|
||||
if (lpEntry->romAddr < g_Rom->GetRomSize())
|
||||
{
|
||||
uint32_t sig = *(uint32_t*)&rom[lpEntry->romAddr];
|
||||
sig = _byteswap_ulong(sig);
|
||||
memcpy(sigc, &sig, 4);
|
||||
sigc[4] = '\0';
|
||||
}
|
||||
|
||||
// Todo checkbox to display all in hex
|
||||
if (isalnum(sigc[0]) && isalnum(sigc[1]) && isalnum(sigc[2]) && isalnum(sigc[3]))
|
||||
|
@ -126,16 +130,6 @@ void CDebugDMALogView::RefreshList()
|
|||
m_nLastStartIndex = dmaLogSize;
|
||||
}
|
||||
|
||||
DWORD WINAPI CDebugDMALogView::AutoRefreshProc(void* _this)
|
||||
{
|
||||
CDebugDMALogView* self = (CDebugDMALogView*)_this;
|
||||
while (true)
|
||||
{
|
||||
self->RefreshList();
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CDebugDMALogView::OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
//RefreshList();
|
||||
|
@ -151,6 +145,9 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
|||
m_nLastStartIndex = 0;
|
||||
|
||||
m_DMAList.Attach(GetDlgItem(IDC_DMA_LIST));
|
||||
m_DMARamEdit.Attach(GetDlgItem(IDC_DMA_RAM_EDIT));
|
||||
m_DMARomEdit.Attach(GetDlgItem(IDC_DMA_ROM_EDIT));
|
||||
m_BlockInfo.Attach(GetDlgItem(IDC_BLOCK_INFO));
|
||||
|
||||
m_DMAList.ModifyStyle(LVS_OWNERDRAWFIXED, 0, 0);
|
||||
|
||||
|
@ -168,25 +165,45 @@ LRESULT CDebugDMALogView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
|||
//m_DMAList.SetColumnWidth(3, 50);
|
||||
//m_DMAList.SetColumnWidth(4, 50);
|
||||
//m_DMAList.SetColumnWidth(5, 50);
|
||||
|
||||
m_DMARamEdit.Attach(GetDlgItem(IDC_DMA_RAM_EDIT));
|
||||
|
||||
m_DMARamEdit.SetLimitText(8);
|
||||
|
||||
m_DMARomEdit.Attach(GetDlgItem(IDC_DMA_ROM_EDIT));
|
||||
m_DMARomEdit.SetLimitText(8);
|
||||
|
||||
m_BlockInfo.Attach(GetDlgItem(IDC_BLOCK_INFO));
|
||||
|
||||
RefreshList();
|
||||
|
||||
LoadWindowPos();
|
||||
WindowCreated();
|
||||
|
||||
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CDebugDMALogView::RefreshDMALogWindow(bool bReset)
|
||||
{
|
||||
if (m_hWnd == NULL || m_DMAList.m_hWnd == NULL)
|
||||
{
|
||||
if (bReset)
|
||||
{
|
||||
m_DMALog->ClearEntries();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
PostMessage(WM_REFRESH, bReset);
|
||||
}
|
||||
|
||||
LRESULT CDebugDMALogView::OnRefresh(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
bool bReset = (bool)wParam;
|
||||
|
||||
if (bReset)
|
||||
{
|
||||
m_DMALog->ClearEntries();
|
||||
}
|
||||
|
||||
RefreshList();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CDebugDMALogView::OnExitSizeMove(void)
|
||||
{
|
||||
SaveWindowPos();
|
||||
|
@ -194,11 +211,11 @@ void CDebugDMALogView::OnExitSizeMove(void)
|
|||
|
||||
LRESULT CDebugDMALogView::OnDestroy(void)
|
||||
{
|
||||
if (m_AutoRefreshThread != NULL)
|
||||
{
|
||||
TerminateThread(m_AutoRefreshThread, 0);
|
||||
CloseHandle(m_AutoRefreshThread);
|
||||
}
|
||||
m_DMAList.Detach();
|
||||
m_DMARamEdit.Detach();
|
||||
m_DMARomEdit.Detach();
|
||||
m_BlockInfo.Detach();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,16 @@ public:
|
|||
CDebugDMALogView(CDebuggerUI * debugger);
|
||||
virtual ~CDebugDMALogView(void);
|
||||
|
||||
void RefreshList();
|
||||
void RefreshDMALogWindow(bool bReset = false);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
WM_REFRESH = WM_USER + 1
|
||||
};
|
||||
|
||||
void RefreshList(void);
|
||||
|
||||
CDMALog* m_DMALog;
|
||||
|
||||
int m_nLastStartIndex;
|
||||
|
@ -34,9 +41,6 @@ private:
|
|||
bool m_bUniqueRomAddresses;
|
||||
bool m_bFilterChanged;
|
||||
|
||||
HANDLE m_AutoRefreshThread;
|
||||
static DWORD WINAPI AutoRefreshProc(void* _this);
|
||||
|
||||
// Return true if entry meets requirements
|
||||
bool FilterEntry(int dmaLogIndex);
|
||||
|
||||
|
@ -48,6 +52,7 @@ private:
|
|||
bool m_bCustomDrawClrNext;
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnRefresh(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);
|
||||
|
@ -57,6 +62,7 @@ private:
|
|||
void OnExitSizeMove(void);
|
||||
|
||||
BEGIN_MSG_MAP_EX(CDebugDMALogView)
|
||||
MESSAGE_HANDLER(WM_REFRESH, OnRefresh)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
||||
|
@ -65,7 +71,7 @@ private:
|
|||
NOTIFY_HANDLER_EX(IDC_DMA_LIST, NM_CUSTOMDRAW, OnCustomDrawList)
|
||||
CHAIN_MSG_MAP(CDialogResize<CDebugDMALogView>)
|
||||
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
|
||||
END_MSG_MAP()
|
||||
END_MSG_MAP()
|
||||
|
||||
BEGIN_DLGRESIZE_MAP(CDebugDMALogView)
|
||||
DLGRESIZE_CONTROL(IDC_DMA_LIST, DLSZ_SIZE_X | DLSZ_SIZE_Y)
|
||||
|
|
|
@ -93,9 +93,9 @@ void CDebuggerUI::GameReset(CDebuggerUI * _this)
|
|||
_this->m_CommandsView->Reset();
|
||||
}
|
||||
|
||||
if (_this->m_DMALog)
|
||||
if (_this->m_DMALogView)
|
||||
{
|
||||
_this->m_DMALog->ClearEntries();
|
||||
_this->m_DMALogView->RefreshDMALogWindow(true);
|
||||
}
|
||||
|
||||
if (_this->m_StackTrace)
|
||||
|
@ -254,6 +254,14 @@ void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
|||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_RefreshDMALogWindow(void)
|
||||
{
|
||||
if (m_DMALogView)
|
||||
{
|
||||
m_DMALogView->RefreshDMALogWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::OpenMemorySearch()
|
||||
{
|
||||
if (m_MemorySearch == NULL)
|
||||
|
@ -647,7 +655,8 @@ void CDebuggerUI::HandleCartToRamDMA(void)
|
|||
uint32_t dmaLen = opInfo.GetStoreValueUnsigned() + 1;
|
||||
|
||||
m_DMALog->AddEntry(dmaRomAddr, dmaRamAddr, dmaLen);
|
||||
|
||||
Debug_RefreshDMALogWindow();
|
||||
|
||||
// break if write breakpoint exists anywhere in target buffer
|
||||
if (m_Breakpoints->WriteBPExistsInChunk(dmaRamAddr, dmaLen))
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
void Debug_RefreshStackWindow(void);
|
||||
void Debug_RefreshStackTraceWindow(void);
|
||||
void OpenDMALogWindow(void);
|
||||
void Debug_RefreshDMALogWindow(void);
|
||||
void OpenCPULogWindow(void);
|
||||
void Debug_RefreshCPULogWindow(void);
|
||||
void OpenExcBreakpointsWindow(void);
|
||||
|
|
Loading…
Reference in New Issue