allow dumping of all symbols to a signature file

*hopefully* fix the memleak when scrubbing wii discs.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4588 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-11-18 21:11:05 +00:00
parent 1a374ad62c
commit 73af91281a
5 changed files with 37 additions and 26 deletions

View File

@ -64,9 +64,7 @@
#error needs at least version 1000 of MSC
#endif
// Memory leak check defines
#define _CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC_NEW
// Memory leak checks
#define CHECK_HEAP_INTEGRITY()
#define POSIX 0
@ -102,6 +100,11 @@
#include <crtdbg.h>
#undef CHECK_HEAP_INTEGRITY
#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");}
// If you want to see how much a pain in the ass singletons are, for example:
// {614} normal block at 0x030C5310, 188 bytes long.
// Data: <Master Log > 4D 61 73 74 65 72 20 4C 6F 67 00 00 00 00 00 00
struct CrtDebugBreak { CrtDebugBreak(int spot) { _CrtSetBreakAlloc(spot); } };
//CrtDebugBreak breakAt(614);
#endif // end DEBUG/FAST
#else // Not windows

View File

@ -173,6 +173,7 @@ std::string StringFromFormat(const char* format, ...)
buf[writtenCount] = '\0';
std::string temp = buf;
delete[] buf;
return temp;
}

View File

@ -140,7 +140,7 @@ void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix)
std::string prefix_str(prefix);
for (PPCSymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); iter++)
{
if (iter->second.name.substr(0, prefix_str.size()) == prefix_str)
if ((iter->second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty())
{
DBFunc temp_dbfunc;
temp_dbfunc.name = iter->second.name;

View File

@ -334,34 +334,42 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
case IDM_CREATESIGNATUREFILE:
{
wxTextEntryDialog input_prefix(this, wxString::FromAscii("Only export symbols with prefix:"), wxGetTextFromUserPromptStr, _T("."));
if (input_prefix.ShowModal() == wxID_OK) {
std::string prefix(input_prefix.GetValue().mb_str());
wxTextEntryDialog input_prefix(
this,
wxString::FromAscii("Only export symbols with prefix:\n(Blank for all symbols)"),
wxGetTextFromUserPromptStr,
wxEmptyString);
wxString path = wxFileSelector(
if (input_prefix.ShowModal() == wxID_OK)
{
std::string prefix(input_prefix.GetValue().mb_str());
wxString path = wxFileSelector(
_T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString,
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE,
this);
if (! path.IsEmpty()) {
SignatureDB db;
db.Initialize(&g_symbolDB, prefix.c_str());
std::string filename(path.mb_str()); // PPCAnalyst::SaveSignatureDB(
db.Save(path.mb_str());
if (!path.IsEmpty())
{
SignatureDB db;
db.Initialize(&g_symbolDB, prefix.c_str());
std::string filename(path.mb_str());
db.Save(path.mb_str());
}
}
}
}
break;
case IDM_USESIGNATUREFILE:
{
wxString path = wxFileSelector(
wxString path = wxFileSelector(
_T("Apply signature file"), wxEmptyString, wxEmptyString, wxEmptyString,
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_OPEN | wxFD_FILE_MUST_EXIST,
this);
if (! path.IsEmpty()) {
SignatureDB db;
db.Load(path.mb_str());
db.Apply(&g_symbolDB);
}
if (!path.IsEmpty())
{
SignatureDB db;
db.Load(path.mb_str());
db.Apply(&g_symbolDB);
}
}
NotifyMapLoaded();
break;

View File

@ -959,11 +959,11 @@ void CGameListCtrl::OnInstallWAD(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg)
{
wxString textString(wxString::FromAscii(StringFromFormat("%s (%i/%i) - %s", m_currentFilename.c_str(), (int)m_currentItem+1, (int)m_numberItem, text).c_str()));
percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
percent = (((float)m_currentItem) + percent) / (float)m_numberItem;
wxProgressDialog* pDialog = (wxProgressDialog*)arg;
pDialog->Update((int)(percent*1000), textString);
wxString textString(wxString::Format(wxT("%s (%i/%i) - %s"), m_currentFilename.c_str(), (int)m_currentItem+1, (int)m_numberItem, text));
((wxProgressDialog*)arg)->Update((int)(percent*1000), textString);
}
void CGameListCtrl::OnMultiCompressGCM(wxCommandEvent& /*event*/)
@ -1037,8 +1037,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
void CGameListCtrl::CompressCB(const char* text, float percent, void* arg)
{
wxProgressDialog* pDialog = (wxProgressDialog*)arg;
pDialog->Update((int)(percent*1000), wxString::FromAscii(text));
((wxProgressDialog*)arg)->Update((int)(percent*1000), wxString::FromAscii(text));
}
void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))