2009-07-28 15:32:10 -06:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2009-02-22 23:15:48 -07: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/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-08-27 10:08:43 -06:00
|
|
|
|
2009-02-22 23:15:48 -07:00
|
|
|
|
2009-09-02 15:00:45 -06:00
|
|
|
|
2009-02-22 23:15:48 -07:00
|
|
|
// Include
|
2009-08-27 10:08:43 -06:00
|
|
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
2009-02-22 23:15:48 -07:00
|
|
|
#include "Common.h"
|
|
|
|
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/textdlg.h>
|
|
|
|
#include <wx/listctrl.h>
|
|
|
|
#include <wx/thread.h>
|
|
|
|
#include <wx/mstream.h>
|
|
|
|
#include <wx/tipwin.h>
|
|
|
|
#include <wx/fontdlg.h>
|
|
|
|
|
|
|
|
// ugly that this lib included code from the main
|
2009-02-24 12:31:32 -07:00
|
|
|
#include "../../DolphinWX/Src/WxUtils.h"
|
2009-02-22 23:15:48 -07:00
|
|
|
|
|
|
|
#include "Host.h"
|
|
|
|
|
|
|
|
#include "Debugger.h"
|
2009-06-21 02:39:21 -06:00
|
|
|
#include "DebuggerUIUtil.h"
|
2009-02-22 23:15:48 -07:00
|
|
|
|
|
|
|
#include "RegisterWindow.h"
|
|
|
|
#include "BreakpointWindow.h"
|
|
|
|
#include "MemoryWindow.h"
|
|
|
|
#include "JitWindow.h"
|
2009-02-24 12:31:32 -07:00
|
|
|
#include "FileUtil.h"
|
2009-02-22 23:15:48 -07: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 02:39:21 -06:00
|
|
|
#include "PowerPC/PPCSymbolDB.h"
|
2009-02-22 23:15:48 -07:00
|
|
|
#include "PowerPC/SignatureDB.h"
|
|
|
|
#include "PowerPC/PPCTables.h"
|
|
|
|
#include "PowerPC/Jit64/Jit.h"
|
2009-02-23 13:29:55 -07:00
|
|
|
#include "PowerPC/JitCommon/JitCache.h" // for ClearCache()
|
2009-02-22 23:15:48 -07:00
|
|
|
|
|
|
|
#include "PluginManager.h"
|
|
|
|
#include "ConfigManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" // Bitmaps
|
|
|
|
{
|
|
|
|
#include "../resources/toolbar_play.c"
|
|
|
|
#include "../resources/toolbar_pause.c"
|
|
|
|
#include "../resources/toolbar_add_memorycheck.c"
|
|
|
|
#include "../resources/toolbar_delete.c"
|
|
|
|
#include "../resources/toolbar_add_breakpoint.c"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-03 00:54:46 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Save and load settings
|
|
|
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
|
|
|
void CCodeWindow::Load()
|
|
|
|
{
|
|
|
|
IniFile ini;
|
|
|
|
ini.Load(DEBUGGER_CONFIG_FILE);
|
|
|
|
|
|
|
|
// The font to override DebuggerFont with
|
|
|
|
std::string fontDesc;
|
|
|
|
ini.Get("ShowOnStart", "DebuggerFont", &fontDesc);
|
|
|
|
if (!fontDesc.empty())
|
|
|
|
DebuggerFont.SetNativeFontInfoUserDesc(wxString::FromAscii(fontDesc.c_str()));
|
|
|
|
|
|
|
|
// Decide what windows to use
|
|
|
|
ini.Get("ShowOnStart", "Code", &bCodeWindow, true);
|
|
|
|
ini.Get("ShowOnStart", "Registers", &bRegisterWindow, false);
|
|
|
|
ini.Get("ShowOnStart", "Breakpoints", &bBreakpointWindow, false);
|
|
|
|
ini.Get("ShowOnStart", "Memory", &bMemoryWindow, false);
|
|
|
|
ini.Get("ShowOnStart", "JIT", &bJitWindow, false);
|
|
|
|
ini.Get("ShowOnStart", "Sound", &bSoundWindow, false);
|
|
|
|
ini.Get("ShowOnStart", "Video", &bVideoWindow, false);
|
|
|
|
// Get notebook affiliation
|
|
|
|
std::string _Section = StringFromFormat("P - %s",
|
|
|
|
(Parent->ActivePerspective < Parent->Perspectives.size())
|
|
|
|
? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
|
|
|
|
ini.Get(_Section.c_str(), "Log", &iLogWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "Console", &iConsoleWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "Code", &iCodeWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "Registers", &iRegisterWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "Breakpoints", &iBreakpointWindow, 0);
|
|
|
|
ini.Get(_Section.c_str(), "Memory", &iMemoryWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "JIT", &iJitWindow, 1);
|
|
|
|
ini.Get(_Section.c_str(), "Sound", &iSoundWindow, 0);
|
|
|
|
ini.Get(_Section.c_str(), "Video", &iVideoWindow, 0);
|
2009-09-06 12:45:22 -06:00
|
|
|
// Get floating setting
|
|
|
|
ini.Get("Float", "Log", &Parent->bFloatLogWindow, false);
|
|
|
|
ini.Get("Float", "Console", &Parent->bFloatConsoleWindow, false);
|
|
|
|
ini.Get("Float", "Code", &bFloatCodeWindow, false);
|
|
|
|
ini.Get("Float", "Registers", &bFloatRegisterWindow, false);
|
|
|
|
ini.Get("Float", "Breakpoints", &bFloatBreakpointWindow, false);
|
|
|
|
ini.Get("Float", "Memory", &bFloatMemoryWindow, false);
|
|
|
|
ini.Get("Float", "JIT", &bFloatJitWindow, false);
|
|
|
|
ini.Get("Float", "Sound", &bFloatSoundWindow, false);
|
|
|
|
ini.Get("Float", "Video", &bFloatVideoWindow, false);
|
2009-09-03 00:54:46 -06:00
|
|
|
|
|
|
|
// Boot to pause or not
|
|
|
|
ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false);
|
|
|
|
ini.Get("ShowOnStart", "BootToPause", &bBootToPause, true);
|
|
|
|
}
|
|
|
|
void CCodeWindow::Save()
|
|
|
|
{
|
|
|
|
IniFile ini;
|
|
|
|
ini.Load(DEBUGGER_CONFIG_FILE);
|
|
|
|
|
|
|
|
ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
|
|
|
|
|
|
|
|
// Boot to pause or not
|
|
|
|
ini.Set("ShowOnStart", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
|
|
|
|
ini.Set("ShowOnStart", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
|
|
|
|
|
|
|
// Save windows settings
|
|
|
|
//ini.Set("ShowOnStart", "Code", GetMenuBar()->IsChecked(IDM_CODEWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "Registers", GetMenuBar()->IsChecked(IDM_REGISTERWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "Breakpoints", GetMenuBar()->IsChecked(IDM_BREAKPOINTWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "Memory", GetMenuBar()->IsChecked(IDM_MEMORYWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "JIT", GetMenuBar()->IsChecked(IDM_JITWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "Sound", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW));
|
|
|
|
ini.Set("ShowOnStart", "Video", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW));
|
|
|
|
std::string _Section = StringFromFormat("P - %s",
|
|
|
|
(Parent->ActivePerspective < Parent->Perspectives.size())
|
|
|
|
? Parent->Perspectives.at(Parent->ActivePerspective).Name.c_str() : "");
|
|
|
|
ini.Set(_Section.c_str(), "Log", iLogWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Console", iConsoleWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Code", iCodeWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Registers", iRegisterWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Breakpoints", iBreakpointWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Memory", iMemoryWindow);
|
|
|
|
ini.Set(_Section.c_str(), "JIT", iJitWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Sound", iSoundWindow);
|
|
|
|
ini.Set(_Section.c_str(), "Video", iVideoWindow);
|
2009-09-06 12:45:22 -06:00
|
|
|
// Save floating setting
|
|
|
|
ini.Set("Float", "Log", (bool)FindWindowById(IDM_LOGWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Console", (bool)FindWindowById(IDM_CONSOLEWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Code", (bool)FindWindowById(IDM_CODEWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Registers", (bool)FindWindowById(IDM_REGISTERWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Breakpoints", (bool)FindWindowById(IDM_BREAKPOINTWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Memory", (bool)FindWindowById(IDM_MEMORYWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "JIT", (bool)FindWindowById(IDM_JITWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Sound", (bool)FindWindowById(IDM_SOUNDWINDOW_PARENT));
|
|
|
|
ini.Set("Float", "Video", (bool)FindWindowById(IDM_VIDEOWINDOW_PARENT));
|
2009-09-03 00:54:46 -06:00
|
|
|
|
|
|
|
// Save window settings
|
|
|
|
/*
|
|
|
|
ini.Set("CodeWindow", "x", GetPosition().x);
|
|
|
|
ini.Set("CodeWindow", "y", GetPosition().y);
|
|
|
|
ini.Set("CodeWindow", "w", GetSize().GetWidth());
|
|
|
|
ini.Set("CodeWindow", "h", GetSize().GetHeight());
|
|
|
|
ini.Set("MainWindow", "x", GetParent()->GetPosition().x);
|
|
|
|
ini.Set("MainWindow", "y", GetParent()->GetPosition().y);
|
|
|
|
ini.Set("MainWindow", "w", GetParent()->GetSize().GetWidth());
|
|
|
|
ini.Set("MainWindow", "h", GetParent()->GetSize().GetHeight());
|
|
|
|
|
|
|
|
if (m_BreakpointWindow) m_BreakpointWindow->Save(file);
|
|
|
|
if (m_RegisterWindow) m_RegisterWindow->Save(file);
|
|
|
|
if (m_MemoryWindow) m_MemoryWindow->Save(file);
|
|
|
|
if (m_JitWindow) m_JitWindow->Save(file);
|
|
|
|
*/
|
|
|
|
|
|
|
|
ini.Save(DEBUGGER_CONFIG_FILE);
|
|
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-09-02 15:00:45 -06:00
|
|
|
|
|
|
|
|
2009-09-03 00:54:46 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2009-08-27 10:08:43 -06:00
|
|
|
// Symbols, JIT, Profiler
|
|
|
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
2009-09-03 00:54:46 -06:00
|
|
|
void CCodeWindow::CreateMenuSymbols()
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
|
|
|
wxMenu *pSymbolsMenu = new wxMenu;
|
|
|
|
pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _T("&Clear symbols"));
|
|
|
|
// pSymbolsMenu->Append(IDM_CLEANSYMBOLS, _T("&Clean symbols (zz)"));
|
|
|
|
pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _T("&Generate symbol map"));
|
|
|
|
pSymbolsMenu->AppendSeparator();
|
|
|
|
pSymbolsMenu->Append(IDM_LOADMAPFILE, _T("&Load symbol map"));
|
|
|
|
pSymbolsMenu->Append(IDM_SAVEMAPFILE, _T("&Save symbol map"));
|
|
|
|
pSymbolsMenu->AppendSeparator();
|
|
|
|
pSymbolsMenu->Append(IDM_SAVEMAPFILEWITHCODES, _T("Save code"),
|
|
|
|
wxString::FromAscii("Save the entire disassembled code. This may take a several seconds"
|
|
|
|
" 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();
|
|
|
|
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file..."));
|
|
|
|
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _T("&Use signature file..."));
|
|
|
|
pSymbolsMenu->AppendSeparator();
|
|
|
|
pSymbolsMenu->Append(IDM_PATCHHLEFUNCTIONS, _T("&Patch HLE functions"));
|
2009-03-02 14:10:46 -07:00
|
|
|
pSymbolsMenu->Append(IDM_RENAME_SYMBOLS, _T("&Rename symbols from file..."));
|
2009-02-22 23:15:48 -07:00
|
|
|
pMenuBar->Append(pSymbolsMenu, _T("&Symbols"));
|
|
|
|
|
|
|
|
wxMenu *pProfilerMenu = new wxMenu;
|
|
|
|
pProfilerMenu->Append(IDM_PROFILEBLOCKS, _T("&Profile blocks"), wxEmptyString, wxITEM_CHECK);
|
|
|
|
pProfilerMenu->AppendSeparator();
|
|
|
|
pProfilerMenu->Append(IDM_WRITEPROFILE, _T("&Write to profile.txt, show"));
|
|
|
|
pMenuBar->Append(pProfilerMenu, _T("&Profiler"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
if (Core::GetState() == Core::CORE_RUN) {
|
|
|
|
event.Skip();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_PROFILEBLOCKS:
|
2009-07-15 14:15:34 -06:00
|
|
|
jit.ClearCache();
|
2009-02-22 23:15:48 -07:00
|
|
|
Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS);
|
|
|
|
break;
|
|
|
|
case IDM_WRITEPROFILE:
|
|
|
|
Profiler::WriteProfileResults("profiler.txt");
|
2009-02-24 12:31:32 -07:00
|
|
|
WxUtils::Launch("profiler.txt");
|
2009-02-22 23:15:48 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
|
|
|
{
|
2009-09-03 01:59:24 -06:00
|
|
|
Parent->ClearStatusBar();
|
|
|
|
|
2009-09-03 03:13:41 -06:00
|
|
|
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
|
|
|
|
2009-02-22 23:15:48 -07:00
|
|
|
std::string mapfile = CBoot::GenerateMapFilename();
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_CLEARSYMBOLS:
|
2009-09-03 03:13:41 -06:00
|
|
|
if(!AskYesNo("Do you want to clear the list of symbol names?", "Confirm", wxYES_NO)) return;
|
2009-02-22 23:15:48 -07:00
|
|
|
g_symbolDB.Clear();
|
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_CLEANSYMBOLS:
|
|
|
|
g_symbolDB.Clear("zz");
|
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_SCANFUNCTIONS:
|
|
|
|
{
|
2009-06-08 12:34:24 -06:00
|
|
|
PPCAnalyst::FindFunctions(0x80000000, 0x80400000, &g_symbolDB);
|
2009-02-22 23:15:48 -07:00
|
|
|
SignatureDB db;
|
2009-05-07 15:19:55 -06:00
|
|
|
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
2009-09-03 03:13:41 -06:00
|
|
|
{
|
2009-02-22 23:15:48 -07:00
|
|
|
db.Apply(&g_symbolDB);
|
2009-09-03 03:13:41 -06:00
|
|
|
Parent->StatusBarMessage("Generated symbol names from '%s'", TOTALDB);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Parent->StatusBarMessage("'%s' not found, no symbol names generated", TOTALDB);
|
|
|
|
}
|
2009-02-22 23:15:48 -07:00
|
|
|
// HLE::PatchFunctions();
|
2009-09-03 03:13:41 -06:00
|
|
|
// Update GUI
|
2009-02-22 23:15:48 -07:00
|
|
|
NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDM_LOADMAPFILE:
|
|
|
|
if (!File::Exists(mapfile.c_str()))
|
|
|
|
{
|
|
|
|
g_symbolDB.Clear();
|
2009-03-02 14:10:46 -07:00
|
|
|
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
|
2009-02-22 23:15:48 -07:00
|
|
|
SignatureDB db;
|
2009-05-07 15:19:55 -06:00
|
|
|
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
|
2009-02-22 23:15:48 -07:00
|
|
|
db.Apply(&g_symbolDB);
|
2009-09-03 01:59:24 -06:00
|
|
|
Parent->StatusBarMessage("'%s' not found, scanning for common functions instead", mapfile.c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-22 23:15:48 -07:00
|
|
|
g_symbolDB.LoadMap(mapfile.c_str());
|
2009-09-03 01:59:24 -06:00
|
|
|
Parent->StatusBarMessage("Loaded symbols from '%s'", mapfile.c_str());
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
2009-03-02 14:10:46 -07:00
|
|
|
HLE::PatchFunctions();
|
2009-02-22 23:15:48 -07: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 14:10:46 -07:00
|
|
|
|
|
|
|
case IDM_RENAME_SYMBOLS:
|
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_T("Apply signature file"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_T("Dolphin Symbole Rename File (*.sym)|*.sym;"), wxFD_OPEN | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
|
|
|
if (path)
|
|
|
|
{
|
2009-03-02 14:39:06 -07:00
|
|
|
FILE *f = fopen(path.mb_str(), "r");
|
2009-03-02 14:10:46 -07:00
|
|
|
if (!f)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (!feof(f))
|
|
|
|
{
|
2009-03-05 15:35:06 -07:00
|
|
|
char line[512];
|
2009-03-02 14:10:46 -07:00
|
|
|
fgets(line, 511, f);
|
|
|
|
if (strlen(line) < 4)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
u32 address, type;
|
|
|
|
char name[512];
|
|
|
|
sscanf(line, "%08x %02i %s", &address, &type, name);
|
|
|
|
|
|
|
|
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
|
|
|
|
if (symbol) {
|
|
|
|
symbol->name = line+12;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-02-22 23:15:48 -07:00
|
|
|
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());
|
|
|
|
|
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_T("Save signature as"), wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
_T("Dolphin Signature File (*.dsy)|*.dsy;"), wxFD_SAVE,
|
|
|
|
this);
|
|
|
|
if (path) {
|
|
|
|
SignatureDB db;
|
|
|
|
db.Initialize(&g_symbolDB, prefix.c_str());
|
2009-08-01 23:59:55 -06:00
|
|
|
std::string filename(path.mb_str()); // PPCAnalyst::SaveSignatureDB(
|
|
|
|
db.Save(path.mb_str());
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_USESIGNATUREFILE:
|
|
|
|
{
|
|
|
|
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) {
|
|
|
|
SignatureDB db;
|
2009-08-01 23:59:55 -06:00
|
|
|
db.Load(path.mb_str());
|
2009-02-22 23:15:48 -07:00
|
|
|
db.Apply(&g_symbolDB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NotifyMapLoaded();
|
|
|
|
break;
|
|
|
|
case IDM_PATCHHLEFUNCTIONS:
|
|
|
|
HLE::PatchFunctions();
|
|
|
|
Update();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CCodeWindow::NotifyMapLoaded()
|
|
|
|
{
|
2009-09-07 06:40:43 -06:00
|
|
|
if (!codeview) return;
|
|
|
|
|
2009-02-22 23:15:48 -07:00
|
|
|
g_symbolDB.FillInCallers();
|
|
|
|
//symbols->Show(false); // hide it for faster filling
|
|
|
|
symbols->Freeze(); // HyperIris: wx style fast filling
|
|
|
|
symbols->Clear();
|
2009-06-21 02:39:21 -06:00
|
|
|
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); iter++)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
|
|
|
int idx = symbols->Append(wxString::FromAscii(iter->second.name.c_str()));
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if(m_MemoryWindow && m_MemoryWindow->IsVisible())
|
|
|
|
m_MemoryWindow->JumpToAddress(pSymbol->address);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
JumpToAddress(pSymbol->address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-08-26 03:19:15 -06:00
|
|
|
|
|
|
|
// Change the global DebuggerFont
|
|
|
|
void CCodeWindow::OnChangeFont(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxFontData data;
|
|
|
|
data.SetInitialFont(GetFont());
|
|
|
|
|
|
|
|
wxFontDialog dialog(this, data);
|
|
|
|
if ( dialog.ShowModal() == wxID_OK )
|
|
|
|
DebuggerFont = dialog.GetFontData().GetChosenFont();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-02 15:00:45 -06:00
|
|
|
|
|
|
|
|
2009-08-26 03:19:15 -06:00
|
|
|
// Toogle windows
|
|
|
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
2009-08-30 23:56:30 -06:00
|
|
|
|
2009-08-26 19:30:08 -06:00
|
|
|
void CCodeWindow::OpenPages()
|
|
|
|
{
|
2009-08-30 13:44:42 -06:00
|
|
|
Parent->DoToggleWindow(IDM_CODEWINDOW, true);
|
2009-08-29 00:08:14 -06:00
|
|
|
if (bRegisterWindow) Parent->DoToggleWindow(IDM_REGISTERWINDOW, true);
|
|
|
|
if (bBreakpointWindow) Parent->DoToggleWindow(IDM_BREAKPOINTWINDOW, true);
|
|
|
|
if (bMemoryWindow) Parent->DoToggleWindow(IDM_MEMORYWINDOW, true);
|
|
|
|
if (bJitWindow) Parent->DoToggleWindow(IDM_JITWINDOW, true);
|
|
|
|
if (bSoundWindow) Parent->DoToggleWindow(IDM_SOUNDWINDOW, true);
|
|
|
|
if (bVideoWindow) Parent->DoToggleWindow(IDM_VIDEOWINDOW, true);
|
2009-08-26 19:30:08 -06:00
|
|
|
}
|
2009-08-26 17:28:30 -06:00
|
|
|
void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
|
|
|
|
{
|
2009-09-07 06:40:43 -06:00
|
|
|
event.Skip();
|
2009-08-27 04:10:07 -06:00
|
|
|
Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
|
2009-08-26 03:19:15 -06:00
|
|
|
}
|
2009-09-02 23:24:30 -06:00
|
|
|
void CCodeWindow::OnToggleCodeWindow(bool _Show, int i)
|
2009-08-30 13:44:42 -06:00
|
|
|
{
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-08-30 13:44:42 -06:00
|
|
|
{
|
2009-09-06 12:45:22 -06:00
|
|
|
Parent->DoAddPage(this, i, wxT("Code"), bFloatCodeWindow);
|
2009-08-30 13:44:42 -06:00
|
|
|
}
|
|
|
|
else // hide
|
|
|
|
Parent->DoRemovePage (this);
|
|
|
|
}
|
2009-09-02 23:24:30 -06:00
|
|
|
void CCodeWindow::OnToggleRegisterWindow(bool _Show, int i)
|
2009-08-26 03:19:15 -06:00
|
|
|
{
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-04 22:50:45 -06:00
|
|
|
if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(Parent, IDM_REGISTERWINDOW);
|
2009-09-06 12:45:22 -06:00
|
|
|
Parent->DoAddPage(m_RegisterWindow, i, wxT("Registers"), bFloatRegisterWindow);
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
else // hide
|
2009-08-27 04:10:07 -06:00
|
|
|
Parent->DoRemovePage (m_RegisterWindow);
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
|
2009-09-02 23:24:30 -06:00
|
|
|
void CCodeWindow::OnToggleBreakPointWindow(bool _Show, int i)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-04 22:50:45 -06:00
|
|
|
if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, Parent, IDM_BREAKPOINTWINDOW);
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-09-06 12:45:22 -06:00
|
|
|
Parent->DoAddPage(m_BreakpointWindow, i, wxT("Breakpoints"), bFloatBreakpointWindow);
|
2009-08-31 20:41:48 -06:00
|
|
|
#else
|
|
|
|
m_BreakpointWindow->Show();
|
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
else // hide
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-08-27 04:10:07 -06:00
|
|
|
Parent->DoRemovePage(m_BreakpointWindow);
|
2009-08-31 20:41:48 -06:00
|
|
|
#else
|
|
|
|
if (m_BreakpointWindow) m_BreakpointWindow->Hide();
|
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
|
2009-09-04 22:50:45 -06:00
|
|
|
|
|
|
|
void CCodeWindow::OnToggleMemoryWindow(bool _Show, int i)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-04 22:50:45 -06:00
|
|
|
if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(Parent, IDM_MEMORYWINDOW);
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-09-06 12:45:22 -06:00
|
|
|
Parent->DoAddPage(m_MemoryWindow, i, wxT("Memory"), bFloatMemoryWindow);
|
2009-08-31 20:41:48 -06:00
|
|
|
#else
|
2009-09-04 22:50:45 -06:00
|
|
|
m_MemoryWindow->Show();
|
2009-08-31 20:41:48 -06:00
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
else // hide
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-09-04 22:50:45 -06:00
|
|
|
Parent->DoRemovePage(m_MemoryWindow);
|
|
|
|
#else
|
|
|
|
if (m_MemoryWindow) m_MemoryWindow->Hide();
|
2009-08-31 20:41:48 -06:00
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-04 22:50:45 -06:00
|
|
|
void CCodeWindow::OnToggleJitWindow(bool _Show, int i)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-02-22 23:15:48 -07:00
|
|
|
{
|
2009-09-04 22:50:45 -06:00
|
|
|
if (!m_JitWindow) m_JitWindow = new CJitWindow(Parent, IDM_JITWINDOW);
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-09-06 12:45:22 -06:00
|
|
|
Parent->DoAddPage(m_JitWindow, i, wxT("JIT"), bFloatJitWindow);
|
2009-08-31 20:41:48 -06:00
|
|
|
#else
|
2009-09-04 22:50:45 -06:00
|
|
|
m_JitWindow->Show();
|
2009-08-31 20:41:48 -06:00
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
else // hide
|
2009-08-31 20:41:48 -06:00
|
|
|
#ifdef _WIN32
|
2009-09-04 22:50:45 -06:00
|
|
|
Parent->DoRemovePage(m_JitWindow);
|
|
|
|
#else
|
|
|
|
if (m_JitWindow) m_JitWindow->Hide();
|
2009-08-31 20:41:48 -06:00
|
|
|
#endif
|
2009-02-22 23:15:48 -07:00
|
|
|
}
|
|
|
|
|
2009-09-01 06:44:02 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notice: This windows docking for plugin windows will produce several wx debugging messages when
|
|
|
|
::GetWindowRect and ::DestroyWindow fails in wxApp::CleanUp() for the plugin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-09-07 07:33:40 -06:00
|
|
|
// Toggle Sound Debugging Window
|
|
|
|
void CCodeWindow::OnToggleDLLWindow(int Id, bool _Show, int i)
|
2009-08-26 03:19:15 -06:00
|
|
|
{
|
2009-09-07 06:40:43 -06:00
|
|
|
#ifdef _WIN32
|
|
|
|
// ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
2009-08-26 17:28:30 -06:00
|
|
|
|
2009-09-07 07:33:40 -06:00
|
|
|
std::string DLLName;
|
|
|
|
wxString Title;
|
|
|
|
int PLUGINTYPE;
|
|
|
|
|
|
|
|
switch(Id)
|
|
|
|
{
|
|
|
|
case IDM_SOUNDWINDOW:
|
|
|
|
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str();
|
|
|
|
PLUGINTYPE = PLUGIN_TYPE_DSP;
|
|
|
|
Title = wxT("Sound");
|
|
|
|
break;
|
|
|
|
case IDM_VIDEOWINDOW:
|
|
|
|
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str();
|
|
|
|
PLUGINTYPE = PLUGIN_TYPE_VIDEO;
|
|
|
|
Title = wxT("Video");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-09-02 23:24:30 -06:00
|
|
|
if (_Show)
|
2009-08-26 03:19:15 -06:00
|
|
|
{
|
2009-08-30 16:04:30 -06:00
|
|
|
if (Parent->GetNotebookCount() == 0) return;
|
|
|
|
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
|
2009-09-07 07:33:40 -06:00
|
|
|
wxWindow *Win = Parent->GetWxWindow(Title);
|
2009-09-04 22:50:45 -06:00
|
|
|
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
2009-08-26 17:28:30 -06:00
|
|
|
|
2009-09-07 07:33:40 -06:00
|
|
|
// Show window
|
|
|
|
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
|
2009-09-07 06:40:43 -06:00
|
|
|
|
2009-09-07 07:33:40 -06:00
|
|
|
Win = Parent->GetWxWindow(Title);
|
2009-08-26 17:28:30 -06:00
|
|
|
if (Win)
|
2009-09-01 01:32:07 -06:00
|
|
|
{
|
2009-09-07 07:33:40 -06:00
|
|
|
Win->SetName(Title);
|
2009-09-01 01:32:07 -06:00
|
|
|
Win->Reparent(Parent);
|
2009-09-07 06:40:43 -06:00
|
|
|
Win->SetId(IDM_SOUNDWINDOW);
|
2009-09-07 07:33:40 -06:00
|
|
|
Parent->GetNotebookFromId(i)->AddPage(Win, Title, true, Parent->aNormalFile);
|
2009-09-01 01:32:07 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win not found\n").c_str());
|
2009-09-07 07:33:40 -06:00
|
|
|
}
|
2009-08-26 03:19:15 -06:00
|
|
|
}
|
2009-09-07 06:40:43 -06:00
|
|
|
else
|
|
|
|
{
|
2009-09-07 07:33:40 -06:00
|
|
|
wxWindow *Win = Parent->GetWxWindow(Title);
|
2009-09-01 06:44:02 -06:00
|
|
|
if (Win)
|
2009-09-07 06:40:43 -06:00
|
|
|
{
|
2009-09-01 06:44:02 -06:00
|
|
|
Parent->DoRemovePage(Win, false);
|
2009-09-07 06:40:43 -06:00
|
|
|
//Win->Reparent(NULL);
|
|
|
|
// Destroy
|
2009-09-07 07:33:40 -06:00
|
|
|
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
|
2009-09-07 06:40:43 -06:00
|
|
|
//WARN_LOG(CONSOLE, "Sound removed from NB");
|
2009-09-01 06:44:02 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-07 06:40:43 -06:00
|
|
|
//WARN_LOG(CONSOLE, "Sound not found (Win %i)", FindWindowByName(wxT("Sound")));
|
2009-09-01 06:44:02 -06:00
|
|
|
}
|
2009-09-07 06:40:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2009-09-07 07:33:40 -06:00
|
|
|
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
|
2009-09-07 06:40:43 -06:00
|
|
|
#endif
|
2009-09-07 07:33:40 -06:00
|
|
|
}
|