From 2f308cf77accfe9125eb2bf5fc53348fd9aaa058 Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Thu, 24 Jul 2008 13:40:07 +0000 Subject: [PATCH] minor improvements (mostly debugger) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@82 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/IniFile.h | 1 + .../Core/Src/Debugger/Debugger_SymbolMap.cpp | 4 +- Source/Core/DebuggerWX/DebuggerWX.vcproj | 8 + .../Core/DebuggerWX/resources/toolbar_pause.c | 277 +++++++++++++++++ .../Core/DebuggerWX/resources/toolbar_play.c | 278 ++++++++++++++++++ .../Core/DebuggerWX/src/BreakpointWindow.cpp | 23 ++ Source/Core/DebuggerWX/src/BreakpointWindow.h | 4 + Source/Core/DebuggerWX/src/CodeWindow.cpp | 191 ++++++------ Source/Core/DebuggerWX/src/CodeWindow.h | 13 +- Source/Core/DebuggerWX/src/LogWindow.cpp | 27 +- Source/Core/DebuggerWX/src/LogWindow.h | 9 +- Source/Core/DebuggerWX/src/MemoryCheckDlg.cpp | 2 +- Source/Core/DebuggerWX/src/MemoryWindow.cpp | 27 +- Source/Core/DebuggerWX/src/MemoryWindow.h | 3 + Source/Core/DebuggerWX/src/RegisterWindow.cpp | 24 +- Source/Core/DebuggerWX/src/RegisterWindow.h | 4 + .../Plugin_PadSimple/Src/ConfigDlg.cpp | 9 + .../Plugins/Plugin_PadSimple/Src/ConfigDlg.h | 2 + .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 36 ++- 19 files changed, 808 insertions(+), 134 deletions(-) create mode 100644 Source/Core/DebuggerWX/resources/toolbar_pause.c create mode 100644 Source/Core/DebuggerWX/resources/toolbar_play.c diff --git a/Source/Core/Common/Src/IniFile.h b/Source/Core/Common/Src/IniFile.h index 71532d78f4..8addaea7c3 100644 --- a/Source/Core/Common/Src/IniFile.h +++ b/Source/Core/Common/Src/IniFile.h @@ -61,6 +61,7 @@ class IniFile void Set(const char* sectionName, const char* key, const std::vector& newValues); + // getter should be const bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = ""); bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0); bool Get(const char* sectionName, const char* key, u32* value, u32 defaultValue = 0); diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp index 5b93f0516b..5b9dd481e7 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp +++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp @@ -14,9 +14,11 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ + #include "Common.h" #include "StringUtil.h" #include "Debugger_SymbolMap.h" +#include "../Core.h" #include "../HW/Memmap.h" #include "../PowerPC/PowerPC.h" #include "../PowerPC/PPCAnalyst.h" @@ -357,7 +359,7 @@ void AnalyzeBackwards() bool GetCallstack(std::vector &output) { - if (!Memory::IsInitialized()) + if (Core::GetState() == Core::CORE_UNINITIALIZED) return false; if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1])) diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index a28d06ec3f..4cccc3935f 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -461,6 +461,14 @@ RelativePath=".\resources\toolbar_delete.c" > + + + + Connect(wxID_ANY, wxEVT_KEY_DOWN, + wxKeyEventHandler(CCodeWindow::OnKeyDown), + (wxObject*)0, this); + // load ini... IniFile file; file.Load("Debugger.ini"); + this->Load(file); + m_BreakpointWindow->Load(file); + m_LogWindow->Load(file); + m_RegisterWindow->Load(file); + m_MemoryWindow->Load(file); +} + + +CCodeWindow::~CCodeWindow() +{ + IniFile file; + file.Load("Debugger.ini"); + + this->Save(file); + m_BreakpointWindow->Save(file); + m_LogWindow->Save(file); + m_RegisterWindow->Save(file); + m_MemoryWindow->Save(file); + + file.Save("Debugger.ini"); +} + + +void CCodeWindow::Load( IniFile &file ) +{ + int x,y,w,h; file.Get("Code", "x", &x, GetPosition().x); file.Get("Code", "y", &y, GetPosition().y); file.Get("Code", "w", &w, GetSize().GetWidth()); file.Get("Code", "h", &h, GetSize().GetHeight()); this->SetSize(x, y, w, h); +} - // These really should be in the respective constructors. - if (m_BreakpointWindow) { - file.Get("BreakPoint", "x", &x, m_BreakpointWindow->GetPosition().x); - file.Get("BreakPoint", "y", &y, m_BreakpointWindow->GetPosition().y); - file.Get("BreakPoint", "w", &w, m_BreakpointWindow->GetSize().GetWidth()); - file.Get("BreakPoint", "h", &h, m_BreakpointWindow->GetSize().GetHeight()); - m_BreakpointWindow->SetSize(x, y, w, h); - } - if (m_logwindow) { - file.Get("LogWindow", "x", &x, m_logwindow->GetPosition().x); - file.Get("LogWindow", "y", &y, m_logwindow->GetPosition().y); - file.Get("LogWindow", "w", &w, m_logwindow->GetSize().GetWidth()); - file.Get("LogWindow", "h", &h, m_logwindow->GetSize().GetHeight()); - m_logwindow->SetSize(x, y, w, h); - } - - if (m_RegisterWindow) { - file.Get("RegisterWindow", "x", &x, m_RegisterWindow->GetPosition().x); - file.Get("RegisterWindow", "y", &y, m_RegisterWindow->GetPosition().y); - //file.Get("RegisterWindow", "w", &w, m_RegisterWindow->GetSize().GetWidth()); - //file.Get("RegisterWindow", "h", &h, m_RegisterWindow->GetSize().GetHeight()); - m_RegisterWindow->SetSize(x, y, w, h); - } - - if (m_MemoryWindow) { - file.Get("MemoryWindow", "x", &x, m_MemoryWindow->GetPosition().x); - file.Get("MemoryWindow", "y", &y, m_MemoryWindow->GetPosition().y); - file.Get("MemoryWindow", "w", &w, m_MemoryWindow->GetSize().GetWidth()); - file.Get("MemoryWindow", "h", &h, m_MemoryWindow->GetSize().GetHeight()); - m_RegisterWindow->SetSize(x, y, w, h); - } +void CCodeWindow::Save(IniFile &file) const +{ + file.Set("Code", "x", GetPosition().x); + file.Set("Code", "y", GetPosition().y); + file.Set("Code", "w", GetSize().GetWidth()); + file.Set("Code", "h", GetSize().GetHeight()); } @@ -169,8 +175,8 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart // additional dialogs if (IsLoggingActivated()) { - m_logwindow = new CLogWindow(this); - m_logwindow->Show(true); + m_LogWindow = new CLogWindow(this); + m_LogWindow->Show(true); } m_RegisterWindow = new CRegisterWindow(this); @@ -184,48 +190,6 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart } -CCodeWindow::~CCodeWindow() -{ - IniFile file; - file.Load("Debugger.ini"); - - file.Set("Code", "x", GetPosition().x); - file.Set("Code", "y", GetPosition().y); - file.Set("Code", "w", GetSize().GetWidth()); - file.Set("Code", "h", GetSize().GetHeight()); - - // These really should be in the respective destructors. - if (m_BreakpointWindow) { - file.Set("BreakPoint", "x", m_BreakpointWindow->GetPosition().x); - file.Set("BreakPoint", "y", m_BreakpointWindow->GetPosition().y); - file.Set("BreakPoint", "w", m_BreakpointWindow->GetSize().GetWidth()); - file.Set("BreakPoint", "h", m_BreakpointWindow->GetSize().GetHeight()); - } - - if (m_logwindow) { - file.Set("LogWindow", "x", m_logwindow->GetPosition().x); - file.Set("LogWindow", "y", m_logwindow->GetPosition().y); - file.Set("LogWindow", "w", m_logwindow->GetSize().GetWidth()); - file.Set("LogWindow", "h", m_logwindow->GetSize().GetHeight()); - } - - if (m_RegisterWindow) { - file.Set("RegisterWindow", "x", m_RegisterWindow->GetPosition().x); - file.Set("RegisterWindow", "y", m_RegisterWindow->GetPosition().y); - file.Set("RegisterWindow", "w", m_RegisterWindow->GetSize().GetWidth()); - file.Set("RegisterWindow", "h", m_RegisterWindow->GetSize().GetHeight()); - } - - if (m_MemoryWindow) { - file.Set("MemoryWindow", "x", m_MemoryWindow->GetPosition().x); - file.Set("MemoryWindow", "y", m_MemoryWindow->GetPosition().y); - file.Set("MemoryWindow", "w", m_MemoryWindow->GetSize().GetWidth()); - file.Set("MemoryWindow", "h", m_MemoryWindow->GetSize().GetHeight()); - } - file.Save("Debugger.ini"); -} - - void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter) { wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE); @@ -307,16 +271,8 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event) break; case IDM_STEP: - { - CCPU::StepOpcode(&sync_event); -// if (CCPU::IsStepping()) -// sync_event.Wait(); - wxThread::Sleep(20); - // need a short wait here - codeview->Center(PC); - Update(); - Host_UpdateLogDisplay(); - } + SingleCPUStep(); + break; case IDM_STEPOVER: @@ -410,7 +366,7 @@ void CCodeWindow::NotifyMapLoaded() void CCodeWindow::UpdateButtonStates() { - wxToolBarBase* toolBar = GetToolBar(); + wxToolBar* toolBar = GetToolBar(); if (Core::GetState() == Core::CORE_UNINITIALIZED) { toolBar->EnableTool(IDM_DEBUG_GO, false); @@ -423,6 +379,7 @@ void CCodeWindow::UpdateButtonStates() if (!CCPU::IsStepping()) { toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause")); + toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]); toolBar->EnableTool(IDM_DEBUG_GO, true); toolBar->EnableTool(IDM_STEP, false); toolBar->EnableTool(IDM_STEPOVER, false); @@ -430,7 +387,8 @@ void CCodeWindow::UpdateButtonStates() } else { - toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Go")); + toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play")); + toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]); toolBar->EnableTool(IDM_DEBUG_GO, true); toolBar->EnableTool(IDM_STEP, true); toolBar->EnableTool(IDM_STEPOVER, true); @@ -472,12 +430,12 @@ void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event) if (show) { - if (!m_logwindow) + if (!m_LogWindow) { - m_logwindow = new CLogWindow(this); + m_LogWindow = new CLogWindow(this); } - m_logwindow->Show(true); + m_LogWindow->Show(true); } else // hide { @@ -485,11 +443,11 @@ void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event) // didn't report the checked menu item status correctly. // It should be true just after the menu item was selected, // if there was no modeless dialog yet. - wxASSERT(m_logwindow != NULL); + wxASSERT(m_LogWindow != NULL); - if (m_logwindow) + if (m_LogWindow) { - m_logwindow->Hide(); + m_LogWindow->Hide(); } } } @@ -589,9 +547,9 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event) case IDM_UPDATELOGDISPLAY: - if (m_logwindow) + if (m_LogWindow) { - m_logwindow->NotifyUpdate(); + m_LogWindow->NotifyUpdate(); } break; @@ -624,7 +582,7 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar) h = m_Bitmaps[Toolbar_DebugGo].GetHeight(); toolBar->SetToolBitmapSize(wxSize(w, h)); - toolBar->AddTool(IDM_DEBUG_GO, _T("Go"), m_Bitmaps[Toolbar_DebugGo], _T("Delete the selected BreakPoint or MemoryCheck")); + toolBar->AddTool(IDM_DEBUG_GO, _T("Play"), m_Bitmaps[Toolbar_DebugGo], _T("Delete the selected BreakPoint or MemoryCheck")); toolBar->AddTool(IDM_STEP, _T("Step"), m_Bitmaps[Toolbar_Step], _T("Add BreakPoint...")); toolBar->AddTool(IDM_STEPOVER, _T("Step Over"), m_Bitmaps[Toolbar_StepOver], _T("Add BreakPoint...")); toolBar->AddTool(IDM_SKIP, _T("Skip"), m_Bitmaps[Toolbar_Skip], _T("Add BreakPoint...")); @@ -659,12 +617,13 @@ void CCodeWindow::RecreateToolbar() void CCodeWindow::InitBitmaps() { // load original size 48x48 - m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_delete_png); + m_Bitmaps[Toolbar_DebugGo] = wxGetBitmapFromMemory(toolbar_play_png); m_Bitmaps[Toolbar_Step] = wxGetBitmapFromMemory(toolbar_add_breakpoint_png); m_Bitmaps[Toolbar_StepOver] = wxGetBitmapFromMemory(toolbar_add_memcheck_png); m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png); m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png); m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png); + m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png); // scale to 16x16 for toolbar @@ -673,3 +632,29 @@ void CCodeWindow::InitBitmaps() m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(16, 16)); } } + + +void CCodeWindow::OnKeyDown(wxKeyEvent& event) +{ + if (event.GetKeyCode() == WXK_SPACE) + { + SingleCPUStep(); + } + else + { + event.Skip(); + } +} + + +void CCodeWindow::SingleCPUStep() +{ + CCPU::StepOpcode(&sync_event); + // if (CCPU::IsStepping()) + // sync_event.Wait(); + wxThread::Sleep(20); + // need a short wait here + codeview->Center(PC); + Update(); + Host_UpdateLogDisplay(); +} \ No newline at end of file diff --git a/Source/Core/DebuggerWX/src/CodeWindow.h b/Source/Core/DebuggerWX/src/CodeWindow.h index 3d8a8db5d4..e068769ed5 100644 --- a/Source/Core/DebuggerWX/src/CodeWindow.h +++ b/Source/Core/DebuggerWX/src/CodeWindow.h @@ -32,6 +32,7 @@ class CLogWindow; class CBreakPointWindow; class CMemoryWindow; class CCodeView; +class IniFile; class CCodeWindow : public wxFrame @@ -45,7 +46,10 @@ class CCodeWindow const wxSize& size = wxSize(400, 500), long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE); - ~CCodeWindow(); + ~CCodeWindow(); + + void Load(IniFile &file); + void Save(IniFile &file) const; void Update(); void NotifyMapLoaded(); @@ -79,6 +83,7 @@ class CCodeWindow enum { Toolbar_DebugGo, + Toolbar_Pause, Toolbar_Step, Toolbar_StepOver, Toolbar_Skip, @@ -88,7 +93,7 @@ class CCodeWindow }; // sub dialogs - CLogWindow* m_logwindow; + CLogWindow* m_LogWindow; CRegisterWindow* m_RegisterWindow; CBreakPointWindow* m_BreakpointWindow; CMemoryWindow* m_MemoryWindow; @@ -105,6 +110,9 @@ class CCodeWindow void OnSymbolListChange(wxCommandEvent& event); void OnCallstackListChange(wxCommandEvent& event); void OnCodeStep(wxCommandEvent& event); + + void SingleCPUStep(); + void OnAddrBoxChange(wxCommandEvent& event); void OnToggleRegisterWindow(wxCommandEvent& event); @@ -121,6 +129,7 @@ class CCodeWindow void PopulateToolbar(wxToolBar* toolBar); void InitBitmaps(); void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter); + void OnKeyDown(wxKeyEvent& event); }; #endif /*CODEWINDOW_*/ diff --git a/Source/Core/DebuggerWX/src/LogWindow.cpp b/Source/Core/DebuggerWX/src/LogWindow.cpp index 0cd1233823..05003d4f49 100644 --- a/Source/Core/DebuggerWX/src/LogWindow.cpp +++ b/Source/Core/DebuggerWX/src/LogWindow.cpp @@ -28,10 +28,10 @@ #include "IniFile.h" BEGIN_EVENT_TABLE(CLogWindow, wxDialog) -EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit) -EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog) -EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear) -EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck) + EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit) + EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog) + EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear) + EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck) END_EVENT_TABLE() @@ -72,6 +72,25 @@ CLogWindow::CLogWindow(wxWindow* parent) } +void CLogWindow::Save(IniFile& _IniFile) const +{ + _IniFile.Set("LogWindow", "x", GetPosition().x); + _IniFile.Set("LogWindow", "y", GetPosition().y); + _IniFile.Set("LogWindow", "w", GetSize().GetWidth()); + _IniFile.Set("LogWindow", "h", GetSize().GetHeight()); +} + + +void CLogWindow::Load(IniFile& _IniFile) +{ + int x,y,w,h; + _IniFile.Get("LogWindow", "x", &x, GetPosition().x); + _IniFile.Get("LogWindow", "y", &y, GetPosition().y); + _IniFile.Get("LogWindow", "w", &w, GetSize().GetWidth()); + _IniFile.Get("LogWindow", "h", &h, GetSize().GetHeight()); + SetSize(x, y, w, h); +} + void CLogWindow::OnSubmit(wxCommandEvent& event) { Console_Submit(m_cmdline->GetValue().To8BitData()); diff --git a/Source/Core/DebuggerWX/src/LogWindow.h b/Source/Core/DebuggerWX/src/LogWindow.h index ebd0f35198..1fb5060db1 100644 --- a/Source/Core/DebuggerWX/src/LogWindow.h +++ b/Source/Core/DebuggerWX/src/LogWindow.h @@ -18,10 +18,9 @@ #ifndef LOGWINDOW_H_ #define LOGWINDOW_H_ -#include "wx/dialog.h" -#include "wx/textctrl.h" -#include "wx/checklst.h" -#include "Debugger.h" +class wxTextCtrl; +class wxCheckListBox; +class IniFile; class CLogWindow : public wxDialog @@ -31,6 +30,8 @@ class CLogWindow CLogWindow(wxWindow* parent); void NotifyUpdate(); + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); private: diff --git a/Source/Core/DebuggerWX/src/MemoryCheckDlg.cpp b/Source/Core/DebuggerWX/src/MemoryCheckDlg.cpp index 1ca887c35b..f22e869601 100644 --- a/Source/Core/DebuggerWX/src/MemoryCheckDlg.cpp +++ b/Source/Core/DebuggerWX/src/MemoryCheckDlg.cpp @@ -108,4 +108,4 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& /*event*/) void MemoryCheckDlg::OnCancel(wxCommandEvent& /*event*/) { Close(); -} +} diff --git a/Source/Core/DebuggerWX/src/MemoryWindow.cpp b/Source/Core/DebuggerWX/src/MemoryWindow.cpp index b323d7c26d..fac7a46e3a 100644 --- a/Source/Core/DebuggerWX/src/MemoryWindow.cpp +++ b/Source/Core/DebuggerWX/src/MemoryWindow.cpp @@ -38,14 +38,6 @@ // ugly that this lib included code from the main #include "../../DolphinWX/src/Globals.h" -class SymbolList - : public wxListCtrl -{ - wxString OnGetItemText(long item, long column) - { - return(_T("hello")); - } -}; enum { @@ -107,6 +99,25 @@ CMemoryWindow::~CMemoryWindow() } +void CMemoryWindow::Save(IniFile& _IniFile) const +{ + _IniFile.Set("MemoryWindow", "x", GetPosition().x); + _IniFile.Set("MemoryWindow", "y", GetPosition().y); + _IniFile.Set("MemoryWindow", "w", GetSize().GetWidth()); + _IniFile.Set("MemoryWindow", "h", GetSize().GetHeight()); +} + + +void CMemoryWindow::Load(IniFile& _IniFile) +{ + int x,y,w,h; + _IniFile.Get("MemoryWindow", "x", &x, GetPosition().x); + _IniFile.Get("MemoryWindow", "y", &y, GetPosition().y); + _IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth()); + _IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight()); + SetSize(x, y, w, h); +} + void CMemoryWindow::JumpToAddress(u32 _Address) { diff --git a/Source/Core/DebuggerWX/src/MemoryWindow.h b/Source/Core/DebuggerWX/src/MemoryWindow.h index fffb55201d..763d82cdfc 100644 --- a/Source/Core/DebuggerWX/src/MemoryWindow.h +++ b/Source/Core/DebuggerWX/src/MemoryWindow.h @@ -45,6 +45,9 @@ class CMemoryWindow ~CMemoryWindow(); + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + void Update(); void NotifyMapLoaded(); diff --git a/Source/Core/DebuggerWX/src/RegisterWindow.cpp b/Source/Core/DebuggerWX/src/RegisterWindow.cpp index f54bdb1079..266361b91c 100644 --- a/Source/Core/DebuggerWX/src/RegisterWindow.cpp +++ b/Source/Core/DebuggerWX/src/RegisterWindow.cpp @@ -19,12 +19,12 @@ #include "RegisterWindow.h" #include "PowerPC/PowerPC.h" #include "RegisterView.h" +#include "IniFile.h" extern const char* GetGRPName(unsigned int index); - BEGIN_EVENT_TABLE(CRegisterWindow, wxDialog) -EVT_CLOSE(CRegisterWindow::OnClose) + EVT_CLOSE(CRegisterWindow::OnClose) END_EVENT_TABLE() CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) @@ -39,6 +39,26 @@ CRegisterWindow::~CRegisterWindow() {} +void CRegisterWindow::Save(IniFile& _IniFile) const +{ + _IniFile.Set("RegisterWindow", "x", GetPosition().x); + _IniFile.Set("RegisterWindow", "y", GetPosition().y); + _IniFile.Set("RegisterWindow", "w", GetSize().GetWidth()); + _IniFile.Set("RegisterWindow", "h", GetSize().GetHeight()); +} + + +void CRegisterWindow::Load(IniFile& _IniFile) +{ + int x,y,w,h; + _IniFile.Get("RegisterWindow", "x", &x, GetPosition().x); + _IniFile.Get("RegisterWindow", "y", &y, GetPosition().y); + _IniFile.Get("RegisterWindow", "w", &w, GetSize().GetWidth()); + _IniFile.Get("RegisterWindow", "h", &h, GetSize().GetHeight()); + SetSize(x, y, w, h); +} + + void CRegisterWindow::CreateGUIControls() { SetTitle(wxT("Registers")); diff --git a/Source/Core/DebuggerWX/src/RegisterWindow.h b/Source/Core/DebuggerWX/src/RegisterWindow.h index 3c6bd4cabe..92e544c698 100644 --- a/Source/Core/DebuggerWX/src/RegisterWindow.h +++ b/Source/Core/DebuggerWX/src/RegisterWindow.h @@ -19,6 +19,7 @@ #define __REGISTERWINDOW_h__ class CRegisterView; +class IniFile; #undef RegisterWindow_STYLE #define RegisterWindow_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX @@ -35,6 +36,9 @@ class CRegisterWindow CRegisterWindow(wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Registers"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = RegisterWindow_STYLE); virtual ~CRegisterWindow(); + void Save(IniFile& _IniFile) const; + void Load(IniFile& _IniFile); + void NotifyUpdate(); diff --git a/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.cpp index 098135f39d..74a6ba35ac 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.cpp @@ -97,6 +97,15 @@ LRESULT CConfigDlg::OnCommand(UINT /*uMsg*/, WPARAM _wParam, LPARAM _lParam, BOO } +LRESULT CConfigDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) +{ + m_dinput.Free(); + + EndDialog(0); + return(0); +} + + LRESULT CConfigDlg::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if (m_hWaitForKeyButton != NULL) diff --git a/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.h b/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.h index f46e68fecb..a352340318 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_PadSimple/Src/ConfigDlg.h @@ -28,6 +28,7 @@ class CConfigDlg MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_COMMAND, OnCommand) MESSAGE_HANDLER(WM_TIMER, OnTimer) + MESSAGE_HANDLER(WM_CLOSE, OnClose) COMMAND_ID_HANDLER(IDOK, OnCloseCmd) END_MSG_MAP() @@ -45,6 +46,7 @@ class CConfigDlg LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); LRESULT OnCommand(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); LRESULT OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); + LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/); LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/); void SetButtonText(CButton& _rButton, int _key); }; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 86dfccac43..8ba760ce3e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -17,6 +17,7 @@ #include "ConfigDlg.h" +#include "../Globals.h" BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) EVT_CLOSE(ConfigDialog::OnClose) @@ -31,6 +32,8 @@ END_EVENT_TABLE() ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { + g_Config.Load(); + CreateGUIControls(); } @@ -40,8 +43,13 @@ ConfigDialog::~ConfigDialog() void ConfigDialog::CreateGUIControls() { - m_Notebook = new wxNotebook(this, ID_PAGEENHANCEMENTS, wxPoint(0,0),wxSize(484,198)); + // buttons + m_OK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(404,208), wxSize(73,25), 0, wxDefaultValidator, wxT("OK")); + m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxPoint(324,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Apply")); + m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxPoint(244,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Close")); + // notebook + m_Notebook = new wxNotebook(this, ID_PAGEENHANCEMENTS, wxPoint(0,0),wxSize(484,198)); m_PageVideo = new wxPanel(m_Notebook, ID_PAGEVIDEO, wxPoint(4,24), wxSize(476,170)); m_Notebook->AddPage(m_PageVideo, wxT("Video")); @@ -52,46 +60,54 @@ void ConfigDialog::CreateGUIControls() m_Notebook->AddPage(m_PageAdvanced, wxT("Advanced")); m_Fullscreen = new wxCheckBox(m_PageVideo, ID_FULLSCREEN, wxT("Fullscreen"), wxPoint(12,16), wxSize(137,25), 0, wxDefaultValidator, wxT("Fullscreen")); + m_Fullscreen->SetValue(g_Config.bFullscreen); + // page1 m_RenderToMainWindow = new wxCheckBox(m_PageVideo, ID_RENDERTOMAINWINDOW, wxT("Render to Main Window"), wxPoint(12,40), wxSize(137,25), 0, wxDefaultValidator, wxT("RenderToMainWindow")); + m_RenderToMainWindow->SetValue(g_Config.renderToMainframe); + // all other options doesnt to anything so lets disable them wxArrayString arrayStringFor_FullscreenCB; m_FullscreenCB = new wxComboBox(m_PageVideo, ID_FULLSCREENCB, wxT("FullscreenCB"), wxPoint(132,72), wxSize(121,21), arrayStringFor_FullscreenCB, 0, wxDefaultValidator, wxT("FullscreenCB")); + m_FullscreenCB->Enable(false); wxArrayString arrayStringFor_WindowResolutionCB; m_WindowResolutionCB = new wxComboBox(m_PageVideo, ID_WINDOWRESOLUTIONCB, wxT("WxComboBox1"), wxPoint(132,104), wxSize(121,21), arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator, wxT("WindowResolutionCB")); + m_WindowResolutionCB->Enable(false); wxStaticText *WxStaticText1 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT1, wxT("Windowed Resolution:"), wxPoint(12,104), wxDefaultSize, 0, wxT("WxStaticText1")); wxStaticText *WxStaticText2 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT2, wxT("Fullscreen Video Mode:"), wxPoint(12,72), wxDefaultSize, 0, wxT("WxStaticText2")); wxArrayString arrayStringFor_AliasModeCB; m_AliasModeCB = new wxComboBox(m_PageVideo, ID_ALIASMODECB, wxT("WxComboBox1"), wxPoint(132,136), wxSize(121,21), arrayStringFor_AliasModeCB, 0, wxDefaultValidator, wxT("AliasModeCB")); + m_AliasModeCB->Enable(false); wxStaticText *WxStaticText3 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT3, wxT("Alias Mode:"), wxPoint(12,136), wxDefaultSize, 0, wxT("WxStaticText3")); m_ForceFiltering = new wxCheckBox(m_PageEnhancements, ID_FORCEFILTERING, wxT("Force bi/trlinear (May cause small glitches)"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceFiltering")); + m_ForceFiltering->Enable(false); m_ForceAnsitropy = new wxCheckBox(m_PageEnhancements, ID_FORCEANSITROPY, wxT("Force maximum ansitropy filtering"), wxPoint(12,48), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceAnsitropy")); + m_ForceAnsitropy->Enable(false); m_Wireframe = new wxCheckBox(m_PageAdvanced, ID_WIREFRAME, wxT("Wireframe"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("Wireframe")); + m_Wireframe->Enable(false); m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump texture to:"), wxPoint(12,88), wxSize(233,25), 0, wxDefaultValidator, wxT("DumpTextures")); + m_DumpTextures->Enable(false); m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxPoint(12,40), wxSize(233,25), 0, wxDefaultValidator, wxT("Statistics")); + m_Statistics->Enable(false); m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxPoint(12,64), wxSize(233,25), 0, wxDefaultValidator, wxT("ShaderErrors")); + m_ShaderErrors->Enable(false); m_Browse = new wxButton(m_PageAdvanced, ID_BROWSE, wxT("Browse"), wxPoint(156,136), wxSize(65,25), 0, wxDefaultValidator, wxT("Browse")); + m_Browse->Enable(false); m_TexturePath = new wxTextCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxT("TexturePath"), wxPoint(20,136), wxSize(129,25), 0, wxDefaultValidator, wxT("TexturePath")); m_TexturePath->Enable(false); - m_OK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(404,208), wxSize(73,25), 0, wxDefaultValidator, wxT("OK")); - - m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxPoint(324,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Apply")); - - m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxPoint(244,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Close")); - SetTitle(wxT("Opengl Plugin Configuration")); SetIcon(wxNullIcon); SetSize(8,8,492,273); @@ -118,12 +134,14 @@ void ConfigDialog::OKClick(wxCommandEvent& event) if ((event.GetId() == ID_APPLY) || (event.GetId() == ID_OK)) { - // update config from dialog + g_Config.renderToMainframe = m_RenderToMainWindow->GetValue(); + g_Config.bFullscreen = m_Fullscreen->GetValue(); + g_Config.Save(); } if ((event.GetId() == ID_CLOSE) || (event.GetId() == ID_OK)) { - EndModal(0); + Close(); } }