2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
2013-04-15 20:28:55 +00:00
|
|
|
// Official Git repository and contact information can be found at
|
2009-02-23 06:15:48 +00:00
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include "Common.h"
|
2010-07-20 03:23:25 +00:00
|
|
|
#include "CommonPaths.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
#include <wx/fontdlg.h>
|
2011-02-28 20:40:15 +00:00
|
|
|
#include <wx/mimetype.h>
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
#include "Host.h"
|
|
|
|
|
2009-06-21 08:39:21 +00:00
|
|
|
#include "DebuggerUIUtil.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2013-02-28 04:37:38 +00:00
|
|
|
#include "../WxUtils.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
#include "RegisterWindow.h"
|
|
|
|
#include "BreakpointWindow.h"
|
|
|
|
#include "MemoryWindow.h"
|
|
|
|
#include "JitWindow.h"
|
2011-01-31 02:39:25 +00:00
|
|
|
#include "DebuggerPanel.h"
|
2011-01-31 04:36:49 +00:00
|
|
|
#include "DSPDebugWindow.h"
|
2009-02-24 19:31:32 +00:00
|
|
|
#include "FileUtil.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
#include "CodeWindow.h"
|
|
|
|
#include "CodeView.h"
|
|
|
|
|
|
|
|
#include "Core.h"
|
|
|
|
#include "HLE/HLE.h"
|
|
|
|
#include "Boot/Boot.h"
|
|
|
|
#include "LogManager.h"
|
|
|
|
#include "HW/CPU.h"
|
|
|
|
#include "PowerPC/PowerPC.h"
|
|
|
|
#include "Debugger/PPCDebugInterface.h"
|
|
|
|
#include "Debugger/Debugger_SymbolMap.h"
|
|
|
|
#include "PowerPC/PPCAnalyst.h"
|
|
|
|
#include "PowerPC/Profiler.h"
|
2009-06-21 08:39:21 +00:00
|
|
|
#include "PowerPC/PPCSymbolDB.h"
|
2009-02-23 06:15:48 +00:00
|
|
|
#include "PowerPC/SignatureDB.h"
|
|
|
|
#include "PowerPC/PPCTables.h"
|
2010-01-19 19:28:27 +00:00
|
|
|
#include "PowerPC/JitCommon/JitBase.h"
|
2009-02-23 20:29:55 +00:00
|
|
|
#include "PowerPC/JitCommon/JitCache.h" // for ClearCache()
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
#include "ConfigManager.h"
|
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
// Save and load settings
|
2009-09-08 16:07:13 +00:00
|
|
|
// -----------------------------
|
2009-09-03 06:54:46 +00:00
|
|
|
void CCodeWindow::Load()
|
|
|
|
{
|
|
|
|
IniFile ini;
|
2010-02-02 21:56:29 +00:00
|
|
|
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
2009-09-03 06:54:46 +00:00
|
|
|
|
|
|
|
// The font to override DebuggerFont with
|
2010-07-26 03:46:14 +00:00
|
|
|
std::string fontDesc;
|
|
|
|
ini.Get("General", "DebuggerFont", &fontDesc);
|
2009-09-03 06:54:46 +00:00
|
|
|
if (!fontDesc.empty())
|
2013-02-28 08:39:06 +00:00
|
|
|
DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc));
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2010-07-26 03:46:14 +00:00
|
|
|
// Boot to pause or not
|
|
|
|
ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
|
|
|
|
ini.Get("General", "BootToPause", &bBootToPause, true);
|
|
|
|
|
|
|
|
const char* SettingName[] = {
|
|
|
|
"Log",
|
2011-02-21 15:01:00 +00:00
|
|
|
"LogConfig",
|
2010-07-26 03:46:14 +00:00
|
|
|
"Console",
|
|
|
|
"Registers",
|
|
|
|
"Breakpoints",
|
|
|
|
"Memory",
|
|
|
|
"JIT",
|
|
|
|
"Sound",
|
|
|
|
"Video",
|
|
|
|
"Code"
|
|
|
|
};
|
|
|
|
|
|
|
|
// Decide what windows to show
|
|
|
|
for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++)
|
|
|
|
ini.Get("ShowOnStart", SettingName[i], &bShowOnStart[i], false);
|
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
// Get notebook affiliation
|
2010-07-26 03:46:14 +00:00
|
|
|
std::string _Section = "P - " +
|
|
|
|
((Parent->ActivePerspective < Parent->Perspectives.size())
|
2010-07-27 02:39:12 +00:00
|
|
|
? Parent->Perspectives[Parent->ActivePerspective].Name : "Perspective 1");
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2010-07-26 03:46:14 +00:00
|
|
|
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
|
|
|
ini.Get(_Section.c_str(), SettingName[i], &iNbAffiliation[i], 0);
|
|
|
|
|
|
|
|
// Get floating setting
|
|
|
|
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
|
|
|
ini.Get("Float", SettingName[i], &Parent->bFloatWindow[i], false);
|
2009-09-03 06:54:46 +00:00
|
|
|
}
|
2010-07-19 02:09:34 +00:00
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
void CCodeWindow::Save()
|
|
|
|
{
|
|
|
|
IniFile ini;
|
2010-02-02 21:56:29 +00:00
|
|
|
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2010-07-26 03:46:14 +00:00
|
|
|
ini.Set("General", "DebuggerFont",
|
2013-02-28 04:37:38 +00:00
|
|
|
WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
|
2009-09-03 06:54:46 +00:00
|
|
|
|
|
|
|
// Boot to pause or not
|
2010-07-26 03:46:14 +00:00
|
|
|
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
|
|
|
|
ini.Set("General", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
|
|
|
|
|
|
|
const char* SettingName[] = {
|
|
|
|
"Log",
|
2011-02-21 15:01:00 +00:00
|
|
|
"LogConfig",
|
2010-07-26 03:46:14 +00:00
|
|
|
"Console",
|
|
|
|
"Registers",
|
|
|
|
"Breakpoints",
|
|
|
|
"Memory",
|
|
|
|
"JIT",
|
|
|
|
"Sound",
|
|
|
|
"Video",
|
|
|
|
"Code"
|
|
|
|
};
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
// Save windows settings
|
2010-07-26 03:46:14 +00:00
|
|
|
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
|
|
|
|
ini.Set("ShowOnStart", SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i));
|
|
|
|
|
|
|
|
// Save notebook affiliations
|
2010-07-27 02:39:12 +00:00
|
|
|
std::string _Section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name;
|
2010-07-26 03:46:14 +00:00
|
|
|
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
|
|
|
ini.Set(_Section.c_str(), SettingName[i], iNbAffiliation[i]);
|
|
|
|
|
2009-09-06 18:45:22 +00:00
|
|
|
// Save floating setting
|
2010-07-26 03:46:14 +00:00
|
|
|
for (int i = IDM_LOGWINDOW_PARENT; i <= IDM_CODEWINDOW_PARENT; i++)
|
|
|
|
ini.Set("Float", SettingName[i - IDM_LOGWINDOW_PARENT], !!FindWindowById(i));
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2010-02-02 21:56:29 +00:00
|
|
|
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
2009-09-03 06:54:46 +00:00
|
|
|
}
|
2009-09-02 21:00:45 +00:00
|
|
|
|
2009-08-27 16:08:43 +00:00
|
|
|
// Symbols, JIT, Profiler
|
2009-09-08 16:07:13 +00:00
|
|
|
// ----------------
|
2010-07-26 03:46:14 +00:00
|
|
|
void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
|
|
|
wxMenu *pSymbolsMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _("&Clear symbols"));
|
|
|
|
pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _("&Generate symbol map"));
|
2009-02-23 06:15:48 +00:00
|
|
|
pSymbolsMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pSymbolsMenu->Append(IDM_LOADMAPFILE, _("&Load symbol map"));
|
|
|
|
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _("&Save symbol map"));
|
2009-02-23 06:15:48 +00:00
|
|
|
pSymbolsMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _("Save code"),
|
2013-02-28 04:37:38 +00:00
|
|
|
StrToWxStr("Save the entire disassembled code. This may take a several seconds"
|
2009-02-23 06:15:48 +00:00
|
|
|
" and may require between 50 and 100 MB of hard drive space. It will only save code"
|
|
|
|
" that are in the first 4 MB of memory, if you are debugging a game that load .rel"
|
|
|
|
" files with code to memory you may want to increase that to perhaps 8 MB, you can do"
|
|
|
|
" that from SymbolDB::SaveMap().")
|
|
|
|
);
|
|
|
|
|
|
|
|
pSymbolsMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _("&Create signature file..."));
|
|
|
|
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _("&Use signature file..."));
|
2009-02-23 06:15:48 +00:00
|
|
|
pSymbolsMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pSymbolsMenu->Append(IDM_PATCHHLEFUNCTIONS, _("&Patch HLE functions"));
|
|
|
|
pSymbolsMenu->Append(IDM_RENAME_SYMBOLS, _("&Rename symbols from file..."));
|
|
|
|
pMenuBar->Append(pSymbolsMenu, _("&Symbols"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
wxMenu *pProfilerMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
pProfilerMenu->Append(IDM_PROFILEBLOCKS, _("&Profile blocks"), wxEmptyString, wxITEM_CHECK);
|
2009-02-23 06:15:48 +00:00
|
|
|
pProfilerMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
pProfilerMenu->Append(IDM_WRITEPROFILE, _("&Write to profile.txt, show"));
|
|
|
|
pMenuBar->Append(pProfilerMenu, _("&Profiler"));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_PROFILEBLOCKS:
|
2012-03-10 05:24:13 +00:00
|
|
|
Core::SetState(Core::CORE_PAUSE);
|
|
|
|
if (jit != NULL)
|
|
|
|
jit->ClearCache();
|
2009-02-23 06:15:48 +00:00
|
|
|
Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS);
|
2012-03-10 05:24:13 +00:00
|
|
|
Core::SetState(Core::CORE_RUN);
|
2009-02-23 06:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_WRITEPROFILE:
|
2012-03-10 05:24:13 +00:00
|
|
|
if (Core::GetState() == Core::CORE_RUN)
|
|
|
|
Core::SetState(Core::CORE_PAUSE);
|
2011-02-28 20:40:15 +00:00
|
|
|
|
2012-03-10 05:24:13 +00:00
|
|
|
if (Core::GetState() == Core::CORE_PAUSE && PowerPC::GetMode() == PowerPC::MODE_JIT)
|
|
|
|
{
|
|
|
|
if (jit != NULL)
|
2011-02-28 20:40:15 +00:00
|
|
|
{
|
2012-03-10 05:24:13 +00:00
|
|
|
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
|
|
|
|
File::CreateFullPath(filename);
|
|
|
|
Profiler::WriteProfileResults(filename.c_str());
|
|
|
|
|
|
|
|
wxFileType* filetype = NULL;
|
|
|
|
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("txt"))))
|
|
|
|
{
|
|
|
|
// From extension failed, trying with MIME type now
|
|
|
|
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType(_T("text/plain"))))
|
|
|
|
// MIME type failed, aborting mission
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
wxString OpenCommand;
|
2013-03-03 02:34:53 +00:00
|
|
|
OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename));
|
2012-03-10 05:24:13 +00:00
|
|
|
if(!OpenCommand.IsEmpty())
|
|
|
|
wxExecute(OpenCommand, wxEXEC_SYNC);
|
2011-02-28 20:40:15 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
|
|
|
{
|
2009-09-03 07:59:24 +00:00
|
|
|
Parent->ClearStatusBar();
|
|
|
|
|
2009-09-03 09:13:41 +00:00
|
|
|
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
std::string mapfile = CBoot::GenerateMapFilename();
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_CLEARSYMBOLS:
|
2010-12-05 09:04:34 +00:00
|
|
|
if(!AskYesNo("Do you want to clear the list of symbol names?")) return;
|
2009-02-23 06:15:48 +00:00
|
|
|
g_symbolDB.Clear();
|
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_SCANFUNCTIONS:
|
|
|
|
{
|
2009-10-11 16:17:08 +00:00
|
|
|
PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB);
|
2009-02-23 06:15:48 +00:00
|
|
|
SignatureDB db;
|
2009-05-07 21:19:55 +00:00
|
|
|
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
2009-09-03 09:13:41 +00:00
|
|
|
{
|
2009-02-23 06:15:48 +00:00
|
|
|
db.Apply(&g_symbolDB);
|
2010-07-19 02:09:34 +00:00
|
|
|
Parent->StatusBarMessage("Generated symbol names from '%s'", TOTALDB);
|
2009-09-03 09:13:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Parent->StatusBarMessage("'%s' not found, no symbol names generated", TOTALDB);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
// HLE::PatchFunctions();
|
2009-09-03 09:13:41 +00:00
|
|
|
// Update GUI
|
2009-02-23 06:15:48 +00:00
|
|
|
NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDM_LOADMAPFILE:
|
2011-03-01 03:06:14 +00:00
|
|
|
if (!File::Exists(mapfile))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
|
|
|
g_symbolDB.Clear();
|
2009-03-02 21:10:46 +00:00
|
|
|
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
|
2009-02-23 06:15:48 +00:00
|
|
|
SignatureDB db;
|
2009-05-07 21:19:55 +00:00
|
|
|
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
2009-02-23 06:15:48 +00:00
|
|
|
db.Apply(&g_symbolDB);
|
2009-09-03 07:59:24 +00:00
|
|
|
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", mapfile.c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-23 06:15:48 +00:00
|
|
|
g_symbolDB.LoadMap(mapfile.c_str());
|
2009-09-03 07:59:24 +00:00
|
|
|
Parent->StatusBarMessage("Loaded symbols from '%s'", mapfile.c_str());
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-07-19 02:09:34 +00:00
|
|
|
HLE::PatchFunctions();
|
2009-02-23 06:15:48 +00:00
|
|
|
NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_SAVEMAPFILE:
|
|
|
|
g_symbolDB.SaveMap(mapfile.c_str());
|
|
|
|
break;
|
|
|
|
case IDM_SAVEMAPFILEWITHCODES:
|
|
|
|
g_symbolDB.SaveMap(mapfile.c_str(), true);
|
|
|
|
break;
|
2009-03-02 21:10:46 +00:00
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
case IDM_RENAME_SYMBOLS:
|
|
|
|
{
|
2011-03-11 10:21:46 +00:00
|
|
|
const wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Apply signature file"), wxEmptyString,
|
2010-07-23 23:50:09 +00:00
|
|
|
wxEmptyString, wxEmptyString,
|
|
|
|
_T("Dolphin Symbol Rename File (*.sym)|*.sym"),
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
2011-03-11 10:21:46 +00:00
|
|
|
|
|
|
|
if (!path.IsEmpty())
|
2010-07-19 02:09:34 +00:00
|
|
|
{
|
2013-03-01 01:33:39 +00:00
|
|
|
std::ifstream f;
|
|
|
|
OpenFStream(f, WxStrToStr(path), std::ios_base::in);
|
2010-07-19 02:09:34 +00:00
|
|
|
|
2011-03-11 10:21:46 +00:00
|
|
|
std::string line;
|
|
|
|
while (std::getline(f, line))
|
2010-07-19 02:09:34 +00:00
|
|
|
{
|
2011-03-11 10:21:46 +00:00
|
|
|
if (line.length() < 12)
|
2010-07-19 02:09:34 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
u32 address, type;
|
2011-03-11 10:21:46 +00:00
|
|
|
std::string name;
|
|
|
|
|
|
|
|
std::istringstream ss(line);
|
|
|
|
ss >> std::hex >> address >> std::dec >> type >> name;
|
2010-07-19 02:09:34 +00:00
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
|
2011-03-11 10:21:46 +00:00
|
|
|
if (symbol)
|
|
|
|
symbol->name = line.substr(12);
|
2010-07-19 02:09:34 +00:00
|
|
|
}
|
2011-03-11 10:21:46 +00:00
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2009-03-02 21:10:46 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
case IDM_CREATESIGNATUREFILE:
|
|
|
|
{
|
2009-11-18 21:11:05 +00:00
|
|
|
wxTextEntryDialog input_prefix(
|
|
|
|
this,
|
2013-02-28 04:37:38 +00:00
|
|
|
StrToWxStr("Only export symbols with prefix:\n(Blank for all symbols)"),
|
2009-11-18 21:11:05 +00:00
|
|
|
wxGetTextFromUserPromptStr,
|
|
|
|
wxEmptyString);
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2009-11-18 21:11:05 +00:00
|
|
|
if (input_prefix.ShowModal() == wxID_OK)
|
|
|
|
{
|
2013-02-28 04:37:38 +00:00
|
|
|
std::string prefix(WxStrToStr(input_prefix.GetValue()));
|
2009-11-18 21:11:05 +00:00
|
|
|
|
|
|
|
wxString path = wxFileSelector(
|
2009-02-23 06:15:48 +00:00
|
|
|
_T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE,
|
|
|
|
this);
|
2009-11-18 21:11:05 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
{
|
|
|
|
SignatureDB db;
|
|
|
|
db.Initialize(&g_symbolDB, prefix.c_str());
|
2013-02-28 04:37:38 +00:00
|
|
|
db.Save(WxStrToStr(path).c_str());
|
2009-11-18 21:11:05 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_USESIGNATUREFILE:
|
|
|
|
{
|
2009-11-18 21:11:05 +00:00
|
|
|
wxString path = wxFileSelector(
|
2009-02-23 06:15:48 +00:00
|
|
|
_T("Apply signature file"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_OPEN | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
2009-11-18 21:11:05 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
{
|
|
|
|
SignatureDB db;
|
2013-02-28 04:37:38 +00:00
|
|
|
db.Load(WxStrToStr(path).c_str());
|
2009-11-18 21:11:05 +00:00
|
|
|
db.Apply(&g_symbolDB);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_PATCHHLEFUNCTIONS:
|
|
|
|
HLE::PatchFunctions();
|
|
|
|
Update();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::NotifyMapLoaded()
|
|
|
|
{
|
2009-09-07 12:40:43 +00:00
|
|
|
if (!codeview) return;
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
g_symbolDB.FillInCallers();
|
|
|
|
//symbols->Show(false); // hide it for faster filling
|
|
|
|
symbols->Freeze(); // HyperIris: wx style fast filling
|
|
|
|
symbols->Clear();
|
2010-05-28 23:14:16 +00:00
|
|
|
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2013-02-28 08:39:06 +00:00
|
|
|
int idx = symbols->Append(StrToWxStr(iter->second.name));
|
2009-02-23 06:15:48 +00:00
|
|
|
symbols->SetClientData(idx, (void*)&iter->second);
|
|
|
|
}
|
|
|
|
symbols->Thaw();
|
|
|
|
//symbols->Show(true);
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnSymbolListChange(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int index = symbols->GetSelection();
|
|
|
|
if (index >= 0) {
|
|
|
|
Symbol* pSymbol = static_cast<Symbol *>(symbols->GetClientData(index));
|
|
|
|
if (pSymbol != NULL)
|
|
|
|
{
|
|
|
|
if(pSymbol->type == Symbol::SYMBOL_DATA)
|
|
|
|
{
|
2009-09-07 20:51:02 +00:00
|
|
|
if(m_MemoryWindow)// && m_MemoryWindow->IsVisible())
|
2009-02-23 06:15:48 +00:00
|
|
|
m_MemoryWindow->JumpToAddress(pSymbol->address);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
JumpToAddress(pSymbol->address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-26 09:19:15 +00:00
|
|
|
// Change the global DebuggerFont
|
|
|
|
void CCodeWindow::OnChangeFont(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxFontData data;
|
2010-07-26 03:46:14 +00:00
|
|
|
data.SetInitialFont(DebuggerFont);
|
2009-08-26 09:19:15 +00:00
|
|
|
|
|
|
|
wxFontDialog dialog(this, data);
|
|
|
|
if ( dialog.ShowModal() == wxID_OK )
|
|
|
|
DebuggerFont = dialog.GetFontData().GetChosenFont();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Toogle windows
|
2009-08-31 05:56:30 +00:00
|
|
|
|
2009-08-27 01:30:08 +00:00
|
|
|
void CCodeWindow::OpenPages()
|
2010-07-19 02:09:34 +00:00
|
|
|
{
|
|
|
|
ToggleCodeWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[0])
|
|
|
|
Parent->ToggleLogWindow(true);
|
2011-02-21 15:01:00 +00:00
|
|
|
if (bShowOnStart[IDM_LOGCONFIGWINDOW - IDM_LOGWINDOW])
|
|
|
|
Parent->ToggleLogConfigWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_CONSOLEWINDOW - IDM_LOGWINDOW])
|
|
|
|
Parent->ToggleConsole(true);
|
|
|
|
if (bShowOnStart[IDM_REGISTERWINDOW - IDM_LOGWINDOW])
|
2010-07-19 02:09:34 +00:00
|
|
|
ToggleRegisterWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW])
|
2010-07-19 02:09:34 +00:00
|
|
|
ToggleBreakPointWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_MEMORYWINDOW - IDM_LOGWINDOW])
|
2010-07-19 02:09:34 +00:00
|
|
|
ToggleMemoryWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_JITWINDOW - IDM_LOGWINDOW])
|
2010-07-19 02:09:34 +00:00
|
|
|
ToggleJitWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_SOUNDWINDOW - IDM_LOGWINDOW])
|
2011-01-30 17:04:12 +00:00
|
|
|
ToggleSoundWindow(true);
|
2010-07-26 03:46:14 +00:00
|
|
|
if (bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW])
|
2011-01-31 02:39:25 +00:00
|
|
|
ToggleVideoWindow(true);
|
2009-08-27 01:30:08 +00:00
|
|
|
}
|
2010-07-19 02:09:34 +00:00
|
|
|
|
|
|
|
void CCodeWindow::ToggleCodeWindow(bool bShow)
|
2009-08-30 19:44:42 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
if (bShow)
|
2010-07-26 03:46:14 +00:00
|
|
|
Parent->DoAddPage(this,
|
|
|
|
iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW],
|
2010-07-22 02:05:28 +00:00
|
|
|
Parent->bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW]);
|
2010-07-24 02:36:22 +00:00
|
|
|
else // Hide
|
2010-07-19 02:09:34 +00:00
|
|
|
Parent->DoRemovePage(this);
|
2009-08-30 19:44:42 +00:00
|
|
|
}
|
2010-07-19 02:09:34 +00:00
|
|
|
|
|
|
|
void CCodeWindow::ToggleRegisterWindow(bool bShow)
|
2009-08-26 09:19:15 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(bShow);
|
|
|
|
if (bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
if (!m_RegisterWindow)
|
|
|
|
m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
|
2010-07-26 03:46:14 +00:00
|
|
|
Parent->DoAddPage(m_RegisterWindow,
|
|
|
|
iNbAffiliation[IDM_REGISTERWINDOW - IDM_LOGWINDOW],
|
2010-07-22 02:05:28 +00:00
|
|
|
Parent->bFloatWindow[IDM_REGISTERWINDOW - IDM_LOGWINDOW]);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-07-24 02:36:22 +00:00
|
|
|
else // Close
|
2010-07-26 03:46:14 +00:00
|
|
|
{
|
2010-07-24 02:36:22 +00:00
|
|
|
Parent->DoRemovePage(m_RegisterWindow, false);
|
2010-07-26 03:46:14 +00:00
|
|
|
m_RegisterWindow = NULL;
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
void CCodeWindow::ToggleBreakPointWindow(bool bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(bShow);
|
|
|
|
if (bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
if (!m_BreakpointWindow)
|
|
|
|
m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
|
2010-07-26 03:46:14 +00:00
|
|
|
Parent->DoAddPage(m_BreakpointWindow,
|
|
|
|
iNbAffiliation[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW],
|
2010-07-22 02:05:28 +00:00
|
|
|
Parent->bFloatWindow[IDM_BREAKPOINTWINDOW - IDM_LOGWINDOW]);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-07-24 02:36:22 +00:00
|
|
|
else // Close
|
2010-07-26 03:46:14 +00:00
|
|
|
{
|
2010-07-24 02:36:22 +00:00
|
|
|
Parent->DoRemovePage(m_BreakpointWindow, false);
|
2010-07-26 03:46:14 +00:00
|
|
|
m_BreakpointWindow = NULL;
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
void CCodeWindow::ToggleMemoryWindow(bool bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(bShow);
|
|
|
|
if (bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
if (!m_MemoryWindow)
|
|
|
|
m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
|
2010-07-26 03:46:14 +00:00
|
|
|
Parent->DoAddPage(m_MemoryWindow,
|
|
|
|
iNbAffiliation[IDM_MEMORYWINDOW - IDM_LOGWINDOW],
|
2010-07-22 02:05:28 +00:00
|
|
|
Parent->bFloatWindow[IDM_MEMORYWINDOW - IDM_LOGWINDOW]);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-07-24 02:36:22 +00:00
|
|
|
else // Close
|
2010-07-26 03:46:14 +00:00
|
|
|
{
|
2010-07-24 02:36:22 +00:00
|
|
|
Parent->DoRemovePage(m_MemoryWindow, false);
|
2010-07-26 03:46:14 +00:00
|
|
|
m_MemoryWindow = NULL;
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
void CCodeWindow::ToggleJitWindow(bool bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(bShow);
|
|
|
|
if (bShow)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-07-19 02:09:34 +00:00
|
|
|
if (!m_JitWindow)
|
|
|
|
m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
|
2010-07-26 03:46:14 +00:00
|
|
|
Parent->DoAddPage(m_JitWindow,
|
|
|
|
iNbAffiliation[IDM_JITWINDOW - IDM_LOGWINDOW],
|
2010-07-22 02:05:28 +00:00
|
|
|
Parent->bFloatWindow[IDM_JITWINDOW - IDM_LOGWINDOW]);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-07-24 02:36:22 +00:00
|
|
|
else // Close
|
2010-07-26 03:46:14 +00:00
|
|
|
{
|
2010-07-24 02:36:22 +00:00
|
|
|
Parent->DoRemovePage(m_JitWindow, false);
|
2010-07-26 03:46:14 +00:00
|
|
|
m_JitWindow = NULL;
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2011-01-28 18:39:30 +00:00
|
|
|
|
|
|
|
void CCodeWindow::ToggleSoundWindow(bool bShow)
|
|
|
|
{
|
|
|
|
GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(bShow);
|
|
|
|
if (bShow)
|
|
|
|
{
|
2011-01-30 17:04:12 +00:00
|
|
|
if (!m_SoundWindow)
|
|
|
|
m_SoundWindow = new DSPDebuggerLLE(Parent, IDM_SOUNDWINDOW);
|
|
|
|
Parent->DoAddPage(m_SoundWindow,
|
2011-01-28 18:39:30 +00:00
|
|
|
iNbAffiliation[IDM_SOUNDWINDOW - IDM_LOGWINDOW],
|
|
|
|
Parent->bFloatWindow[IDM_SOUNDWINDOW - IDM_LOGWINDOW]);
|
|
|
|
}
|
|
|
|
else // Close
|
|
|
|
{
|
2011-01-30 17:04:12 +00:00
|
|
|
Parent->DoRemovePage(m_SoundWindow, false);
|
|
|
|
m_SoundWindow = NULL;
|
2011-01-28 18:39:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-31 02:39:25 +00:00
|
|
|
void CCodeWindow::ToggleVideoWindow(bool bShow)
|
2009-08-26 09:19:15 +00:00
|
|
|
{
|
2011-01-31 02:39:25 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(bShow);
|
2010-07-19 02:09:34 +00:00
|
|
|
if (bShow)
|
|
|
|
{
|
2011-01-31 02:39:25 +00:00
|
|
|
if (!m_VideoWindow)
|
|
|
|
m_VideoWindow = new GFXDebuggerPanel(Parent, IDM_VIDEOWINDOW);
|
|
|
|
Parent->DoAddPage(m_VideoWindow,
|
|
|
|
iNbAffiliation[IDM_VIDEOWINDOW - IDM_LOGWINDOW],
|
|
|
|
Parent->bFloatWindow[IDM_VIDEOWINDOW - IDM_LOGWINDOW]);
|
2009-08-26 09:19:15 +00:00
|
|
|
}
|
2011-01-31 02:39:25 +00:00
|
|
|
else // Close
|
2010-07-19 02:09:34 +00:00
|
|
|
{
|
2011-01-31 02:39:25 +00:00
|
|
|
Parent->DoRemovePage(m_VideoWindow, false);
|
|
|
|
m_VideoWindow = NULL;
|
2009-09-07 12:40:43 +00:00
|
|
|
}
|
2009-09-07 20:51:02 +00:00
|
|
|
}
|