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 #error needs at least version 1000 of MSC
#endif #endif
// Memory leak check defines // Memory leak checks
#define _CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC_NEW
#define CHECK_HEAP_INTEGRITY() #define CHECK_HEAP_INTEGRITY()
#define POSIX 0 #define POSIX 0
@ -102,6 +100,11 @@
#include <crtdbg.h> #include <crtdbg.h>
#undef CHECK_HEAP_INTEGRITY #undef CHECK_HEAP_INTEGRITY
#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} #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 #endif // end DEBUG/FAST
#else // Not windows #else // Not windows

View File

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

View File

@ -140,7 +140,7 @@ void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix)
std::string prefix_str(prefix); std::string prefix_str(prefix);
for (PPCSymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); iter++) 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; DBFunc temp_dbfunc;
temp_dbfunc.name = iter->second.name; temp_dbfunc.name = iter->second.name;

View File

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

View File

@ -959,11 +959,11 @@ void CGameListCtrl::OnInstallWAD(wxCommandEvent& WXUNUSED (event))
void CGameListCtrl::MultiCompressCB(const char* text, float percent, void* arg) 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*/) void CGameListCtrl::OnMultiCompressGCM(wxCommandEvent& /*event*/)
@ -1037,8 +1037,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
void CGameListCtrl::CompressCB(const char* text, float percent, void* arg) void CGameListCtrl::CompressCB(const char* text, float percent, void* arg)
{ {
wxProgressDialog* pDialog = (wxProgressDialog*)arg; ((wxProgressDialog*)arg)->Update((int)(percent*1000), wxString::FromAscii(text));
pDialog->Update((int)(percent*1000), wxString::FromAscii(text));
} }
void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event)) void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))