Convert GetUserPath to return a std::string instead of a const char *. This simplifies its usage in most cases.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7265 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2011-02-28 20:40:15 +00:00
parent 1b8f476024
commit ba54fac9eb
82 changed files with 408 additions and 449 deletions

View File

@ -16,7 +16,6 @@
// http://code.google.com/p/dolphin-emu/
#include "BreakpointDlg.h"
//#include "Host.h"
#include "StringUtil.h"
#include "PowerPC/PowerPC.h"
#include "BreakpointWindow.h"
@ -63,7 +62,6 @@ void BreakPointDlg::OnOK(wxCommandEvent& WXUNUSED(event))
{
PowerPC::breakpoints.Add(Address);
Parent->NotifyUpdate();
//Host_UpdateBreakPointView();
Close();
}
else

View File

@ -20,7 +20,6 @@
#include <wx/listctrl.h>
#include "Common.h"
#include "BreakpointWindow.h"
class CBreakPointView : public wxListCtrl
{

View File

@ -15,8 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <wx/imaglist.h>
#include "BreakpointWindow.h"
#include "BreakpointView.h"
#include "CodeWindow.h"
#include "HW/Memmap.h"
@ -99,7 +98,7 @@ private:
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
EVT_CLOSE(CBreakPointWindow::OnClose)
EVT_LIST_ITEM_SELECTED(ID_BPS, CBreakPointWindow::OnSelectBP)
EVT_LIST_ITEM_SELECTED(wxID_ANY, CBreakPointWindow::OnSelectBP)
END_EVENT_TABLE()
CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent,
@ -108,7 +107,15 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
: wxPanel(parent, id, position, size, style, title)
, m_pCodeWindow(_pCodeWindow)
{
CreateGUIControls();
m_mgr.SetManagedWindow(this);
m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
m_BreakPointListView = new CBreakPointView(this, wxID_ANY);
m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false));
m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane());
m_mgr.Update();
}
CBreakPointWindow::~CBreakPointWindow()
@ -122,19 +129,6 @@ void CBreakPointWindow::OnClose(wxCloseEvent& event)
event.Skip();
}
void CBreakPointWindow::CreateGUIControls()
{
m_mgr.SetManagedWindow(this);
m_mgr.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);
m_BreakPointListView = new CBreakPointView(this, ID_BPS);
m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top().
LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false));
m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane());
m_mgr.Update();
}
void CBreakPointWindow::NotifyUpdate()
{
m_BreakPointListView->Update();

View File

@ -19,13 +19,11 @@
#define __BREAKPOINTWINDOW_h__
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <wx/aui/aui.h>
class CBreakPointView;
class CBreakPointBar;
class CCodeWindow;
class wxListEvent;
class IniFile;
class CBreakPointWindow : public wxPanel
{
@ -53,18 +51,12 @@ public:
private:
DECLARE_EVENT_TABLE();
enum
{
ID_BPS = 1002,
};
wxAuiManager m_mgr;
CBreakPointView* m_BreakPointListView;
CCodeWindow* m_pCodeWindow;
void OnClose(wxCloseEvent& event);
void OnSelectBP(wxListEvent& event);
void CreateGUIControls();
};
#endif

View File

@ -19,13 +19,6 @@
#include "Common.h"
#include <wx/wx.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 "Host.h"
@ -72,50 +65,14 @@ extern "C" // Bitmaps
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
// Menu bar
EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode) // Options
EVT_MENU(IDM_BOOTTOPAUSE, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont)
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // Jit
EVT_MENU(IDM_JITNOBLOCKCACHE, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu)
EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
EVT_MENU_RANGE(IDM_INTERPRETER, IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont)
EVT_MENU_RANGE(IDM_CLEARCODECACHE, IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
EVT_MENU_RANGE(IDM_LOADMAPFILE, IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU_RANGE(IDM_PROFILEBLOCKS, IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
// Toolbar
EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_TOGGLE_BREAKPOINT, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
EVT_MENU_RANGE(IDM_STEP, IDM_ADDRBOX, CCodeWindow::OnCodeStep)
// Other
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
@ -142,7 +99,30 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
{
InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter);
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
DebugInterface* di = &PowerPC::debug_interface;
codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW);
sizerBig->Add(sizerLeft, 2, wxEXPAND);
sizerBig->Add(codeview, 5, wxEXPAND);
sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST,
wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND);
sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST,
wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
SetSizer(sizerBig);
sizerLeft->Fit(this);
sizerBig->Fit(this);
sync_event.Init();
}
wxMenuBar *CCodeWindow::GetMenuBar()
@ -376,35 +356,6 @@ void CCodeWindow::UpdateCallstack()
callstack->Append(wxString::FromAscii("invalid callstack"));
}
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
// Configure the code window
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
DebugInterface* di = &PowerPC::debug_interface;
codeview = new CCodeView(di, &g_symbolDB, this, ID_CODEVIEW);
sizerBig->Add(sizerLeft, 2, wxEXPAND);
sizerBig->Add(codeview, 5, wxEXPAND);
sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST,
wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND);
sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST,
wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
SetSizer(sizerBig);
sizerLeft->Fit(this);
sizerBig->Fit(this);
sync_event.Init();
}
// Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar *pMenuBar)

View File

@ -28,8 +28,8 @@
#include "CoreParameter.h"
// GUI global
#include "../../DolphinWX/Src/Globals.h"
#include "../../DolphinWX/Src/Frame.h"
#include "../Globals.h"
#include "../Frame.h"
class CFrame;
class CRegisterWindow;
@ -145,7 +145,6 @@ class CCodeWindow
void UpdateCallstack();
void InitBitmaps();
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
CCodeView* codeview;
wxListBox* callstack;

View File

@ -18,16 +18,8 @@
#include "Common.h"
#include "CommonPaths.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>
#include "../../DolphinWX/Src/WxUtils.h"
#include <wx/mimetype.h>
#include "Host.h"
@ -165,7 +157,6 @@ void CCodeWindow::CreateMenuSymbols(wxMenuBar *pMenuBar)
{
wxMenu *pSymbolsMenu = new wxMenu;
pSymbolsMenu->Append(IDM_CLEARSYMBOLS, _("&Clear symbols"));
// pSymbolsMenu->Append(IDM_CLEANSYMBOLS, _("&Clean symbols (zz)"));
pSymbolsMenu->Append(IDM_SCANFUNCTIONS, _("&Generate symbol map"));
pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(IDM_LOADMAPFILE, _("&Load symbol map"));
@ -207,8 +198,25 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
Profiler::g_ProfileBlocks = GetMenuBar()->IsChecked(IDM_PROFILEBLOCKS);
break;
case IDM_WRITEPROFILE:
Profiler::WriteProfileResults("profiler.txt");
WxUtils::Launch("profiler.txt");
if (jit != NULL)
{
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
File::CreateFullPath(filename.c_str());
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;
OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(filename.c_str()));
if(!OpenCommand.IsEmpty())
wxExecute(OpenCommand, wxEXEC_SYNC);
}
break;
}
}
@ -227,10 +235,6 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
g_symbolDB.Clear();
Host_NotifyMapLoaded();
break;
case IDM_CLEANSYMBOLS:
g_symbolDB.Clear("zz");
Host_NotifyMapLoaded();
break;
case IDM_SCANFUNCTIONS:
{
PPCAnalyst::FindFunctions(0x80000000, 0x81800000, &g_symbolDB);

View File

@ -253,58 +253,58 @@ void GFXDebuggerPanel::OnPauseAtNextFrameButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)
{
char dump_path[MAX_PATH];
sprintf(dump_path, "%sDebug/%s/", File::GetUserPath(D_DUMP_IDX), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
if (!File::CreateFullPath(dump_path))
std::string dump_path = File::GetUserPath(D_DUMP_IDX) + "Debug/" +
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID + "/";
if (!File::CreateFullPath(dump_path.c_str()))
return;
switch (m_pDumpList->GetSelection())
{
case 0: // Pixel Shader
DumpPixelShader(dump_path);
DumpPixelShader(dump_path.c_str());
break;
case 1: // Vertex Shader
DumpVertexShader(dump_path);
DumpVertexShader(dump_path.c_str());
break;
case 2: // Pixel Shader Constants
DumpPixelShaderConstants(dump_path);
DumpPixelShaderConstants(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 3: // Vertex Shader Constants
DumpVertexShaderConstants(dump_path);
DumpVertexShaderConstants(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 4: // Textures
DumpTextures(dump_path);
DumpTextures(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 5: // Frame Buffer
DumpFrameBuffer(dump_path);
DumpFrameBuffer(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 6: // Geometry
DumpGeometry(dump_path);
DumpGeometry(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 7: // Vertex Description
DumpVertexDecl(dump_path);
DumpVertexDecl(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 8: // Vertex Matrices
DumpMatrices(dump_path);
DumpMatrices(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
case 9: // Statistics
DumpStats(dump_path);
DumpStats(dump_path.c_str());
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
break;
}

View File

@ -18,8 +18,8 @@
#include "MemoryCheckDlg.h"
#include "Common.h"
#include "StringUtil.h"
#include "Host.h"
#include "PowerPC/PowerPC.h"
#include "BreakpointWindow.h"
#define TEXT_BOX(text) new wxStaticText(this, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize)
@ -29,8 +29,9 @@ BEGIN_EVENT_TABLE(MemoryCheckDlg,wxDialog)
EVT_BUTTON(wxID_CANCEL, MemoryCheckDlg::OnCancel)
END_EVENT_TABLE()
MemoryCheckDlg::MemoryCheckDlg(wxWindow *parent)
MemoryCheckDlg::MemoryCheckDlg(CBreakPointWindow *parent)
: wxDialog(parent, wxID_ANY, _("Memory Check"), wxDefaultPosition, wxDefaultSize)
, m_parent(parent)
{
m_pEditStartAddress = new wxTextCtrl(this, wxID_ANY, wxT(""));
m_pEditEndAddress = new wxTextCtrl(this, wxID_ANY, wxT(""));
@ -111,7 +112,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& WXUNUSED(event))
MemCheck.Break = Break;
PowerPC::memchecks.Add(MemCheck);
Host_UpdateBreakPointView();
m_parent->NotifyUpdate();
Close();
}
}

View File

@ -20,12 +20,15 @@
#include <wx/wx.h>
class CBreakPointWindow;
class MemoryCheckDlg : public wxDialog
{
public:
MemoryCheckDlg(wxWindow *parent);
MemoryCheckDlg(CBreakPointWindow *parent);
private:
CBreakPointWindow *m_parent;
wxCheckBox* m_pReadFlag;
wxCheckBox* m_pWriteFlag;
wxCheckBox* m_log_flag;

View File

@ -231,7 +231,7 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event)
// Write mram to file
void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
{
FILE* f = fopen(File::GetUserPath(F_RAMDUMP_IDX), "wb");
FILE* f = fopen(File::GetUserPath(F_RAMDUMP_IDX).c_str(), "wb");
if (f && Memory::m_pRAM)
{
fwrite(Memory::m_pRAM, Memory::REALRAM_SIZE, 1, f);
@ -246,7 +246,7 @@ void CMemoryWindow::OnDumpMem2( wxCommandEvent& event )
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb");
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX).c_str(), "wb");
if (f && Memory::m_pEXRAM)
{
fwrite(Memory::m_pEXRAM, Memory::EXRAM_SIZE, 1, f);
@ -256,7 +256,7 @@ void CMemoryWindow::OnDumpMem2( wxCommandEvent& event )
else
{
u8* aram = DSP::GetARAMPtr();
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb");
f = fopen(File::GetUserPath(F_ARAMDUMP_IDX).c_str(), "wb");
if (f && aram)
{
fwrite(aram, DSP::ARAM_SIZE, 1, f);