Update the N64 System/Debugger files to allman

This commit is contained in:
Ryan Collins 2015-03-25 18:26:02 -04:00
parent 117c1ef3fc
commit 1c044867ae
7 changed files with 208 additions and 80 deletions

View File

@ -61,7 +61,9 @@ public:
if (m_hWnd) if (m_hWnd)
{ {
SetForegroundWindow((HWND)m_hWnd); SetForegroundWindow((HWND)m_hWnd);
} else { }
else
{
DWORD ThreadID; DWORD ThreadID;
ResetEvent(m_CreatedEvent); ResetEvent(m_CreatedEvent);
m_DialogThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)CreateDebuggerWindow,(LPVOID)this,0, &ThreadID); m_DialogThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)CreateDebuggerWindow,(LPVOID)this,0, &ThreadID);

View File

@ -140,13 +140,19 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
// DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory), // DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory),
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this); // (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
//} //}
//DWORD CDumpMemory::AsciiToHex (const char * HexValue) { //DWORD CDumpMemory::AsciiToHex (const char * HexValue)
//{
// DWORD Count, Finish, Value = 0; // DWORD Count, Finish, Value = 0;
// Finish = strlen(HexValue); // Finish = strlen(HexValue);
// if (Finish > 8 ) { Finish = 8; } // if (Finish > 8 )
// for (Count = 0; Count < Finish; Count++){ // {
// Finish = 8;
// }
// for (Count = 0; Count < Finish; Count++
// {
// Value = (Value << 4); // Value = (Value << 4);
// switch( HexValue[Count] ) { // switch ( HexValue[Count] )
// {
// case '0': break; // case '0': break;
// case '1': Value += 1; break; // case '1': Value += 1; break;
// case '2': Value += 2; break; // case '2': Value += 2; break;
@ -178,7 +184,8 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
//} //}
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam) //int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
//{ //{
// switch (uMsg) { // switch (uMsg)
// {
// case WM_INITDIALOG: // case WM_INITDIALOG:
// { // {
// CDumpMemory * _this = (CDumpMemory *)lParam; // CDumpMemory * _this = (CDumpMemory *)lParam;
@ -199,23 +206,39 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
// case IDC_E_START_ADDR: // case IDC_E_START_ADDR:
// case IDC_E_END_ADDR: // case IDC_E_END_ADDR:
// case IDC_E_ALT_PC: // case IDC_E_ALT_PC:
// if (HIWORD(wParam) == EN_UPDATE) { // if (HIWORD(wParam) == EN_UPDATE)
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class"); // CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// TCHAR szTmp[20], szTmp2[20]; // TCHAR szTmp[20], szTmp2[20];
// DWORD Value; // DWORD Value;
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp)); // GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp); // Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// //if (Value > Stop) { Value = Stop; } // //if (Value > Stop)
// //if (Value < Start) { Value = Start; } // //{
// // Value = Stop;
// //}
// //if (Value < Start)
// //{
// // Value = Start;
// //}
// sprintf(szTmp2,"0x%X",Value); // sprintf(szTmp2,"0x%X",Value);
// if (strcmp(szTmp,szTmp2) != 0) { // if (strcmp(szTmp,szTmp2) != 0)
// {
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2); // SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
// if (_this->SelStop == 0) { _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop; } // if (_this->SelStop == 0)
// {
// _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop;
// }
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop); // SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
// } else { // }
// else
// {
// WORD NewSelStart, NewSelStop; // WORD NewSelStart, NewSelStop;
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop); // SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
// if (NewSelStart != 0) { _this->SelStart = NewSelStart; _this->SelStop = NewSelStop; } // if (NewSelStart != 0)
// {
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
// }
// } // }
// } // }
// break; // break;
@ -348,15 +371,21 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this); // (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
//} //}
// //
//DWORD CDumpMemory::AsciiToHex (const char * HexValue) { //DWORD CDumpMemory::AsciiToHex (const char * HexValue)
//{
// DWORD Count, Finish, Value = 0; // DWORD Count, Finish, Value = 0;
// //
// Finish = strlen(HexValue); // Finish = strlen(HexValue);
// if (Finish > 8 ) { Finish = 8; } // if (Finish > 8 )
// {
// Finish = 8;
// }
// //
// for (Count = 0; Count < Finish; Count++){ // for (Count = 0; Count < Finish; Count++)
// {
// Value = (Value << 4); // Value = (Value << 4);
// switch( HexValue[Count] ) { // switch ( HexValue[Count] )
// {
// case '0': break; // case '0': break;
// case '1': Value += 1; break; // case '1': Value += 1; break;
// case '2': Value += 2; break; // case '2': Value += 2; break;
@ -389,7 +418,8 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
// //
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam) //int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
//{ //{
// switch (uMsg) { // switch (uMsg)
// {
// case WM_INITDIALOG: // case WM_INITDIALOG:
// { // {
// CDumpMemory * _this = (CDumpMemory *)lParam; // CDumpMemory * _this = (CDumpMemory *)lParam;
@ -412,7 +442,8 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
// case IDC_E_START_ADDR: // case IDC_E_START_ADDR:
// case IDC_E_END_ADDR: // case IDC_E_END_ADDR:
// case IDC_E_ALT_PC: // case IDC_E_ALT_PC:
// if (HIWORD(wParam) == EN_UPDATE) { // if (HIWORD(wParam) == EN_UPDATE)
// {
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class"); // CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
// //
// TCHAR szTmp[20], szTmp2[20]; // TCHAR szTmp[20], szTmp2[20];
@ -420,17 +451,29 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
// //
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp)); // GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp); // Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
// //if (Value > Stop) { Value = Stop; } // //if (Value > Stop)
// //if (Value < Start) { Value = Start; } // //{
// // Value = Stop;
// //}
// //if (Value < Start)
// //{
// // Value = Start;
// //}
// sprintf(szTmp2,"0x%X",Value); // sprintf(szTmp2,"0x%X",Value);
// if (strcmp(szTmp,szTmp2) != 0) { // if (strcmp(szTmp,szTmp2) != 0)
// {
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2); // SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
// if (_this->SelStop == 0) { _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop; } // if (_this->SelStop == 0) { _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop; }
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop); // SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
// } else { // }
// else
// {
// WORD NewSelStart, NewSelStop; // WORD NewSelStart, NewSelStop;
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop); // SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
// if (NewSelStart != 0) { _this->SelStart = NewSelStart; _this->SelStop = NewSelStop; } // if (NewSelStart != 0)
// {
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
// }
// } // }
// } // }
// break; // break;

View File

@ -226,7 +226,9 @@ void CDebugMemorySearch::EnableUnknownOptions( bool Enable )
{ {
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search"); ::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
} }
} else { }
else
{
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), false ); ::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), false );
if (Enable) if (Enable)
{ {
@ -249,8 +251,14 @@ void CDebugMemorySearch::SearchForValue( void )
m_UnknownSize.SetCurSel(m_ValueSize.GetCurSel()); m_UnknownSize.SetCurSel(m_ValueSize.GetCurSel());
LPCTSTR DisplayStr = "0x%08X"; LPCTSTR DisplayStr = "0x%08X";
if (Size == _16Bit) { DisplayStr = "0x%04X"; } if (Size == _16Bit)
else if (Size == _8Bit) { DisplayStr = "0x%04X"; } {
DisplayStr = "0x%04X";
}
else if (Size == _8Bit)
{
DisplayStr = "0x%04X";
}
if (!m_HaveResults) if (!m_HaveResults)
{ {
@ -288,7 +296,9 @@ void CDebugMemorySearch::SearchForValue( void )
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search Results"); ::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search Results");
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW); ::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW);
::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN),false); ::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN),false);
} else { }
else
{
int ItemCount = m_SearchResults.GetItemCount(); int ItemCount = m_SearchResults.GetItemCount();
for (int i = ItemCount - 1; i >= 0; i--) for (int i = ItemCount - 1; i >= 0; i--)
{ {
@ -298,7 +308,8 @@ void CDebugMemorySearch::SearchForValue( void )
DWORD NewValue = 0; DWORD NewValue = 0;
BOOL valid = false; BOOL valid = false;
switch (Size) { switch (Size)
{
case _8Bit: case _8Bit:
{ {
BYTE mem = 0; BYTE mem = 0;
@ -328,7 +339,9 @@ void CDebugMemorySearch::SearchForValue( void )
sprintf(LocationStr,DisplayStr,Result.Value); sprintf(LocationStr,DisplayStr,Result.Value);
m_SearchResults.SetItemText(i,3,LocationStr); m_SearchResults.SetItemText(i,3,LocationStr);
Result.Value = NewValue; Result.Value = NewValue;
} else { }
else
{
m_SearchResults.DeleteItem(i); m_SearchResults.DeleteItem(i);
} }
} }
@ -351,8 +364,14 @@ void CDebugMemorySearch::SearchForUnknown()
MemorySize Size = (MemorySize)m_UnknownSize.GetItemData(m_UnknownSize.GetCurSel()); MemorySize Size = (MemorySize)m_UnknownSize.GetItemData(m_UnknownSize.GetCurSel());
m_ValueSize.SetCurSel(m_UnknownSize.GetCurSel()); m_ValueSize.SetCurSel(m_UnknownSize.GetCurSel());
LPCTSTR DisplayStr = "0x%08X"; LPCTSTR DisplayStr = "0x%08X";
if (Size == _16Bit) { DisplayStr = "0x%04X"; } if (Size == _16Bit)
else if (Size == _8Bit) { DisplayStr = "0x%04X"; } {
DisplayStr = "0x%04X";
}
else if (Size == _8Bit)
{
DisplayStr = "0x%04X";
}
if (!m_HaveResults) if (!m_HaveResults)
{ {
m_HaveResults = true; m_HaveResults = true;
@ -411,7 +430,9 @@ void CDebugMemorySearch::SearchForUnknown()
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW); ::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW);
::EnableWindow(GetDlgItem(IDC_RADIO_TEXT),false); ::EnableWindow(GetDlgItem(IDC_RADIO_TEXT),false);
::EnableWindow(GetDlgItem(IDC_RADIO_JAL),false); ::EnableWindow(GetDlgItem(IDC_RADIO_JAL),false);
} else { }
else
{
int ItemCount = m_SearchResults.GetItemCount(); int ItemCount = m_SearchResults.GetItemCount();
for (int i = ItemCount - 1; i >= 0; i--) for (int i = ItemCount - 1; i >= 0; i--)
{ {
@ -422,7 +443,8 @@ void CDebugMemorySearch::SearchForUnknown()
DWORD NewValue = 0; DWORD NewValue = 0;
BOOL valid = false; BOOL valid = false;
switch (Size) { switch (Size)
{
case _8Bit: case _8Bit:
{ {
BYTE mem = 0; BYTE mem = 0;
@ -482,7 +504,9 @@ void CDebugMemorySearch::SearchForUnknown()
sprintf(LocationStr,DisplayStr,Result.Value); sprintf(LocationStr,DisplayStr,Result.Value);
m_SearchResults.SetItemText(i,3,LocationStr); m_SearchResults.SetItemText(i,3,LocationStr);
Result.Value = NewValue; Result.Value = NewValue;
} else { }
else
{
m_SearchResults.DeleteItem(i); m_SearchResults.DeleteItem(i);
} }
} }
@ -652,8 +676,14 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
return false; return false;
} }
if (Size == _32Bit) { StartAddress = ((StartAddress + 3) & ~3); } if (Size == _32Bit)
if (Size == _16Bit) { StartAddress = ((StartAddress + 1) & ~1); } {
StartAddress = ((StartAddress + 3) & ~3);
}
if (Size == _16Bit)
{
StartAddress = ((StartAddress + 1) & ~1);
}
//search memory //search memory
if (StartAddress < g_MMU->RdramSize()) if (StartAddress < g_MMU->RdramSize())
@ -757,4 +787,3 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
} }
return false; return false;
} }

View File

@ -41,7 +41,8 @@ private:
SearchChangeState_Lessthan, SearchChangeState_Lessthan,
}; };
typedef struct { typedef struct
{
DWORD PAddr; DWORD PAddr;
DWORD Value; DWORD Value;
} SearchResultItem; } SearchResultItem;

View File

@ -115,7 +115,8 @@ void CDebugTlb::RefreshTLBWindow (void)
int count; int count;
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb; CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
for (count = 0; count < 32; count ++) { for (count = 0; count < 32; count ++)
{
sprintf(Output,"0x%02X",count); sprintf(Output,"0x%02X",count);
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;
item.iItem = count; item.iItem = count;
@ -128,66 +129,87 @@ void CDebugTlb::RefreshTLBWindow (void)
OldItem.cchTextMax = sizeof( OldText )-1; OldItem.cchTextMax = sizeof( OldText )-1;
OldItem.iSubItem = 0; OldItem.iSubItem = 0;
if (ListView_GetItemCount(hList) <= count) { if (ListView_GetItemCount(hList) <= count)
{
ListView_InsertItem(hList,&item); ListView_InsertItem(hList,&item);
} else { }
else
{
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
} }
if (tlb[count].EntryDefined) { if (tlb[count].EntryDefined)
{
sprintf(Output,"0x%08X",tlb[count].PageMask.Value); sprintf(Output,"0x%08X",tlb[count].PageMask.Value);
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 1; item.iSubItem = 1;
OldItem.iSubItem = 1; OldItem.iSubItem = 1;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
if (tlb[count].EntryDefined) { if (tlb[count].EntryDefined)
{
sprintf(Output,"0x%08X",tlb[count].EntryHi.Value); sprintf(Output,"0x%08X",tlb[count].EntryHi.Value);
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 2; item.iSubItem = 2;
OldItem.iSubItem = 2; OldItem.iSubItem = 2;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
if (tlb[count].EntryDefined) { if (tlb[count].EntryDefined)
{
sprintf(Output,"0x%08X",tlb[count].EntryLo0.Value); sprintf(Output,"0x%08X",tlb[count].EntryLo0.Value);
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 3; item.iSubItem = 3;
OldItem.iSubItem = 3; OldItem.iSubItem = 3;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
if (tlb[count].EntryDefined) { if (tlb[count].EntryDefined)
{
sprintf(Output,"0x%08X",tlb[count].EntryLo1.Value); sprintf(Output,"0x%08X",tlb[count].EntryLo1.Value);
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 4; item.iSubItem = 4;
OldItem.iSubItem = 4; OldItem.iSubItem = 4;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
} }
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb; CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
hList = GetDlgItem(IDC_LIST2); hList = GetDlgItem(IDC_LIST2);
for (count = 0; count < 64; count ++) { for (count = 0; count < 64; count ++)
{
sprintf(Output,"0x%02X",count); sprintf(Output,"0x%02X",count);
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;
item.iItem = count; item.iItem = count;
@ -200,49 +222,65 @@ void CDebugTlb::RefreshTLBWindow (void)
OldItem.cchTextMax = sizeof( OldText )-1; OldItem.cchTextMax = sizeof( OldText )-1;
OldItem.iSubItem = 0; OldItem.iSubItem = 0;
if (ListView_GetItemCount(hList) <= count) { if (ListView_GetItemCount(hList) <= count)
{
item.iItem = ListView_InsertItem(hList,&item); item.iItem = ListView_InsertItem(hList,&item);
} else { }
else
{
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
} }
if (FastTlb[count].ValidEntry) { if (FastTlb[count].ValidEntry)
{
sprintf(Output,"%s",FastTlb[count].VALID?"Yes":"No"); sprintf(Output,"%s",FastTlb[count].VALID?"Yes":"No");
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 1; item.iSubItem = 1;
OldItem.iSubItem = 1; OldItem.iSubItem = 1;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) { if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
{
sprintf(Output,"%s",FastTlb[count].DIRTY?"Yes":"No"); sprintf(Output,"%s",FastTlb[count].DIRTY?"Yes":"No");
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 2; item.iSubItem = 2;
OldItem.iSubItem = 2; OldItem.iSubItem = 2;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) { if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
{
sprintf(Output,"%08X:%08X -> %08X:%08X",FastTlb[count].VSTART,FastTlb[count].VEND, sprintf(Output,"%08X:%08X -> %08X:%08X",FastTlb[count].VSTART,FastTlb[count].VEND,
FastTlb[count].PHYSSTART,FastTlb[count].PHYSEND); FastTlb[count].PHYSSTART,FastTlb[count].PHYSEND);
} else { }
else
{
strcpy(Output,"................"); strcpy(Output,"................");
} }
item.iSubItem = 3; item.iSubItem = 3;
OldItem.iSubItem = 3; OldItem.iSubItem = 3;
ListView_GetItem(hList,&OldItem); ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) { if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
{
ListView_SetItem(hList,&item); ListView_SetItem(hList,&item);
} }
} }

View File

@ -34,7 +34,8 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
memset(m_CompareValid,0,sizeof(m_CompareValid)); memset(m_CompareValid,0,sizeof(m_CompareValid));
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR); HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
if (hScrlBar) { if (hScrlBar)
{
SCROLLINFO si; SCROLLINFO si;
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
@ -162,7 +163,10 @@ LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR )
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem,pListNotify->m_nSubItem); LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem,pListNotify->m_nSubItem);
int Finish = strlen(strValue); int Finish = strlen(strValue);
if (Finish > 8) { Finish = 8; } if (Finish > 8)
{
Finish = 8;
}
DWORD Value = 0; DWORD Value = 0;
for (int i = 0; i < Finish; i++) for (int i = 0; i < Finish; i++)
{ {
@ -206,7 +210,9 @@ LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR )
{ {
WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos); WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos);
} }
} else { }
else
{
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos,(BYTE)Value)) if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos,(BYTE)Value))
{ {
WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos); WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos);
@ -249,7 +255,9 @@ void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
m_MemoryList->SetItemText(LineNumber,i,"-"); m_MemoryList->SetItemText(LineNumber,i,"-");
} }
} }
} else { }
else
{
if ( strcmp( Output, m_MemoryList->GetItemText(LineNumber, 0) ) != 0 ) if ( strcmp( Output, m_MemoryList->GetItemText(LineNumber, 0) ) != 0 )
{ {
m_MemoryList->SetItemText(LineNumber,0,Output); m_MemoryList->SetItemText(LineNumber,0,Output);
@ -286,11 +294,15 @@ void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
if (m_CurrentData[Pos] < 30) if (m_CurrentData[Pos] < 30)
{ {
strcat(Ascii,"."); strcat(Ascii,".");
} else { }
else
{
sprintf(AsciiAddOn,"%c",m_CurrentData[Pos]); sprintf(AsciiAddOn,"%c",m_CurrentData[Pos]);
strcat(Ascii,AsciiAddOn); strcat(Ascii,AsciiAddOn);
} }
} else { }
else
{
m_MemoryList->SetItemText(LineNumber,col,"**"); m_MemoryList->SetItemText(LineNumber,col,"**");
m_MemoryList->SetItemFormat( LineNumber,col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE ); m_MemoryList->SetItemFormat( LineNumber,col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE );
m_MemoryList->SetItemColours( LineNumber, col, GetSysColor( COLOR_WINDOW ), GetSysColor( COLOR_WINDOWTEXT ) ); m_MemoryList->SetItemColours( LineNumber, col, GetSysColor( COLOR_WINDOW ), GetSysColor( COLOR_WINDOWTEXT ) );
@ -393,7 +405,9 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
{ {
ValidData = false; ValidData = false;
} }
} else { }
else
{
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW)) if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW))
{ {
ValidData = false; ValidData = false;
@ -428,7 +442,9 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
{ {
ValidData = false; ValidData = false;
} }
} else { }
else
{
if (!g_MMU->LW_PAddr(Pos, word.UW)) if (!g_MMU->LW_PAddr(Pos, word.UW))
{ {
ValidData = false; ValidData = false;
@ -449,7 +465,8 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
} }
} }
for (int count = 0 ; count < 16;count ++ ){ for (int count = 0 ; count < 16;count ++
{
Insert_MemoryLineDump ( count ); Insert_MemoryLineDump ( count );
} }
} }

View File

@ -44,5 +44,3 @@
#include "Debugger - View Memory.h" #include "Debugger - View Memory.h"
#include "Debugger - Memory Dump.h" #include "Debugger - Memory Dump.h"
#include "Debugger - TLB.h" #include "Debugger - TLB.h"