diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 9e315354f5..04472da2a8 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -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 #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: 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 diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 6eb3580e92..10e1963549 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -173,6 +173,7 @@ std::string StringFromFormat(const char* format, ...) buf[writtenCount] = '\0'; std::string temp = buf; + delete[] buf; return temp; } diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp index 64c4cf64db..ea3c043cf6 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp @@ -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; diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp index b720cafd45..0f9d7d6551 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp @@ -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; diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index 55ce02413e..d88652b26f 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -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))