fix a minor "misfeature" in the symbol table code.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1952 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-01-20 13:13:03 +00:00
parent 8c997e90d9
commit d6443478b0
3 changed files with 33 additions and 23 deletions

View File

@ -93,11 +93,12 @@ void SymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int typ
XFuncMap::iterator iter = functions.find(startAddr); XFuncMap::iterator iter = functions.find(startAddr);
if (iter != functions.end()) if (iter != functions.end())
{ {
// already got it, let's just update name and checksum to be sure. // already got it, let's just update name, checksum & size to be sure.
Symbol *tempfunc = &iter->second; Symbol *tempfunc = &iter->second;
tempfunc->name = name; tempfunc->name = name;
tempfunc->hash = SignatureDB::ComputeCodeChecksum(startAddr, startAddr + size); tempfunc->hash = SignatureDB::ComputeCodeChecksum(startAddr, startAddr + size);
tempfunc->type = type; tempfunc->type = type;
tempfunc->size = size;
} }
else else
{ {
@ -110,6 +111,7 @@ void SymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const char *name, int typ
PPCAnalyst::AnalyzeFunction(startAddr, tf, size); PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
checksumToFunction[tf.hash] = &(functions[startAddr]); checksumToFunction[tf.hash] = &(functions[startAddr]);
} }
tf.size = size;
functions[startAddr] = tf; functions[startAddr] = tf;
} }
} }

View File

@ -45,6 +45,7 @@ enum
IDM_RENAMESYMBOL, IDM_RENAMESYMBOL,
IDM_PATCHALERT, IDM_PATCHALERT,
IDM_COPYFUNCTION, IDM_COPYFUNCTION,
IDM_ADDFUNCTION,
}; };
@ -221,6 +222,8 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp))); wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
} }
break; break;
case IDM_COPYFUNCTION: case IDM_COPYFUNCTION:
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection);
@ -289,6 +292,13 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
} }
break; break;
case IDM_ADDFUNCTION:
{
g_symbolDB.AddFunction(selection);
Host_NotifyMapLoaded();
}
break;
case IDM_RENAMESYMBOL: case IDM_RENAMESYMBOL:
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(selection);
@ -336,6 +346,7 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
menu.Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol); menu.Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol);
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(IDM_RUNTOHERE, _T("&Run To Here")); menu.Append(IDM_RUNTOHERE, _T("&Run To Here"));
menu.Append(IDM_ADDFUNCTION, _T("&Add function"));
menu.Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86")); menu.Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86"));
menu.Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr")); menu.Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr"));
menu.Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert")); menu.Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert"));

View File

@ -22,11 +22,10 @@
#include "Common.h" #include "Common.h"
class CRegTable class CRegTable : public wxGridTableBase
: public wxGridTableBase
{ {
public: public:
CRegTable(){;} CRegTable() {}
int GetNumberCols(void){return 4;} int GetNumberCols(void){return 4;}
int GetNumberRows(void){return 16;} int GetNumberRows(void){return 16;}
bool IsEmptyCell(int, int){return false;} bool IsEmptyCell(int, int){return false;}
@ -34,19 +33,17 @@ class CRegTable
void SetValue(int, int, const wxString &); void SetValue(int, int, const wxString &);
wxGridCellAttr *GetAttr(int, int, wxGridCellAttr::wxAttrKind); wxGridCellAttr *GetAttr(int, int, wxGridCellAttr::wxAttrKind);
private: private:
DECLARE_NO_COPY_CLASS(CRegTable); DECLARE_NO_COPY_CLASS(CRegTable);
}; };
class CRegisterView class CRegisterView : public wxGrid
: public wxGrid
{ {
public: public:
CRegisterView(wxWindow* parent, wxWindowID id); CRegisterView(wxWindow* parent, wxWindowID id);
void Update(); void Update();
u32 m_CachedRegs[32]; u32 m_CachedRegs[32];
bool m_CachedRegHasChanged[32]; bool m_CachedRegHasChanged[32];
}; };
#endif #endif