diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp
index 3495c55842..a0b09e850d 100644
--- a/Source/Core/Common/Src/Plugin.cpp
+++ b/Source/Core/Common/Src/Plugin.cpp
@@ -24,6 +24,8 @@ DynamicLibrary CPlugin::m_hInstLib;
void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0;
void(__cdecl * CPlugin::m_DllAbout) (HWND _hParent) = 0;
void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0;
+void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent) = 0; // phew, is this the last one? how many
+// of these can you have?
void
CPlugin::Release(void)
@@ -31,6 +33,7 @@ CPlugin::Release(void)
m_GetDllInfo = 0;
m_DllAbout = 0;
m_DllConfig = 0;
+ m_DllDebugger = 0;
m_hInstLib.Unload();
}
@@ -43,6 +46,7 @@ CPlugin::Load(const char* _szName)
m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*))m_hInstLib.Get("GetDllInfo");
m_DllAbout = (void (__cdecl*)(HWND))m_hInstLib.Get("DllAbout");
m_DllConfig = (void (__cdecl*)(HWND))m_hInstLib.Get("DllConfig");
+ m_DllDebugger = (void (__cdecl*)(HWND))m_hInstLib.Get("DllDebugger");
return(true);
}
@@ -77,4 +81,12 @@ void CPlugin::About(HWND _hwnd)
m_DllAbout(_hwnd);
}
}
+
+void CPlugin::Debug(HWND _hwnd)
+{
+ if (m_DllDebugger != 0)
+ {
+ m_DllDebugger(_hwnd);
+ }
+}
} // end of namespace Common
diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h
index 449b604abf..ef872bd194 100644
--- a/Source/Core/Common/Src/Plugin.h
+++ b/Source/Core/Common/Src/Plugin.h
@@ -35,6 +35,7 @@ class CPlugin
static void Config(HWND _hwnd);
static void About(HWND _hwnd);
+ static void Debug(HWND _hwnd);
private:
@@ -44,6 +45,7 @@ class CPlugin
static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
static void (__cdecl * m_DllAbout)(HWND _hParent);
static void (__cdecl * m_DllConfig)(HWND _hParent);
+ static void (__cdecl * m_DllDebugger)(HWND _hParent);
};
} // end of namespace Common
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 5e6c003619..b107752693 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -139,11 +139,6 @@ bool Init(const SCoreStartupParameter _CoreParameter)
return false;
}
-#ifdef _WIN32
- if (PluginDSP::DllDebugger)
- PluginDSP::DllDebugger((HWND)_CoreParameter.hMainWindow);
-#endif
-
emuThreadGoing.Init();
g_pThread = new Common::Thread(EmuThread, (void*)&g_CoreStartupParameter);
diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj
index 87bb1ffb45..ededbdbc10 100644
--- a/Source/Core/DebuggerWX/DebuggerWX.vcproj
+++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj
@@ -85,139 +85,6 @@
Name="VCPostBuildEventTool"
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
@@ -532,6 +524,14 @@
Optimization="0"
/>
+
+
+
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index 918ecaf40f..3faaaa8f34 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -55,6 +55,14 @@
#include "PowerPC/Jit64/Jit.h"
#include "PowerPC/Jit64/JitCache.h"
+#include "Plugins/Plugin_DSP.h" // new stuff, to let us open the DLLDebugger
+#include "../../DolphinWX/src/PluginManager.h"
+#include "../../DolphinWX/src/Config.h"
+
+// and here are the classes
+class CPluginInfo;
+class CPluginManager;
+
extern "C" {
#include "../resources/toolbar_play.c"
#include "../resources/toolbar_pause.c"
@@ -75,6 +83,8 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
+ EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleJitWindow)
+ EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleSoundWindow)
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter)
@@ -110,11 +120,18 @@ inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
}
+// =======================================================================================
+// WARNING: If you create a new dialog window you must add m_dialog(NULL) below otherwise
+// m_dialog = true and things will crash.
+// ----------------
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
, m_LogWindow(NULL)
, m_RegisterWindow(NULL)
+ , m_BreakpointWindow(NULL)
+ , m_MemoryWindow(NULL)
+ , m_JitWindow(NULL)
{
InitBitmaps();
@@ -138,7 +155,9 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
if (m_LogWindow) m_LogWindow->Load(file);
if (m_RegisterWindow) m_RegisterWindow->Load(file);
if (m_MemoryWindow) m_MemoryWindow->Load(file);
+ if (m_JitWindow) m_JitWindow->Load(file);
}
+// ===============
CCodeWindow::~CCodeWindow()
@@ -151,6 +170,7 @@ CCodeWindow::~CCodeWindow()
if (m_LogWindow) m_LogWindow->Save(file);
if (m_RegisterWindow) m_RegisterWindow->Save(file);
if (m_MemoryWindow) m_MemoryWindow->Save(file);
+ if (m_JitWindow) m_JitWindow->Save(file);
file.Save("Debugger.ini");
}
@@ -175,11 +195,36 @@ void CCodeWindow::Save(IniFile &file) const
file.Set("Code", "h", GetSize().GetHeight());
}
-
+// =======================================================================================
+// I don't know when you're supposed to be able to use pRegister->Check(true) so I had
+// to set these here. It kept crashing if I placed it after m_LogWindow->Show() below.
+bool bLogWindow = true;
+bool bRegisterWindow = true;
+bool bBreakpointWindow = true;
+bool bMemoryWindow = true;
+bool bJitWindow = true;
+bool bSoundWindow = false;
+// -------------------
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
+ // =======================================================================================
+ // Decide what windows to use
+ // --------------
+ IniFile ini;
+ ini.Load("Debugger.ini");
+
+ ini.Get("ShowOnStart", "LogWindow", &bLogWindow, true);
+ ini.Get("ShowOnStart", "RegisterWindow", &bRegisterWindow, true);
+ ini.Get("ShowOnStart", "BreakpointWindow", &bBreakpointWindow, true);
+ ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, true);
+ ini.Get("ShowOnStart", "JitWindow", &bJitWindow, true);
+ ini.Get("ShowOnStart", "SoundWindow", &bSoundWindow, false);
+ // ===============
+
CreateMenu(_LocalCoreStartupParameter);
+ // =======================================================================================
+ // Configure the code window
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
@@ -202,30 +247,59 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
sizerBig->Fit(this);
sync_event.Init();
+ // =================
+
// additional dialogs
- if (IsLoggingActivated())
+ if (IsLoggingActivated() && bLogWindow)
{
m_LogWindow = new CLogWindow(this);
m_LogWindow->Show(true);
}
- m_RegisterWindow = new CRegisterWindow(this);
- m_RegisterWindow->Show(true);
+ if (bRegisterWindow)
+ {
+ m_RegisterWindow = new CRegisterWindow(this);
+ m_RegisterWindow->Show(true);
+ }
- m_BreakpointWindow = new CBreakPointWindow(this, this);
- m_BreakpointWindow->Show(true);
+ if(bBreakpointWindow)
+ {
+ m_BreakpointWindow = new CBreakPointWindow(this, this);
+ m_BreakpointWindow->Show(true);
+ }
- m_MemoryWindow = new CMemoryWindow(this);
- m_MemoryWindow->Show(true);
+ if(bMemoryWindow)
+ {
+ m_MemoryWindow = new CMemoryWindow(this);
+ m_MemoryWindow->Show(true);
+ }
- m_JitWindow = new CJitWindow(this);
- m_JitWindow->Show(true);
+ if(bJitWindow)
+ {
+ m_JitWindow = new CJitWindow(this);
+ m_JitWindow->Show(true);
+ }
+
+ if(IsLoggingActivated() && bSoundWindow)
+ {
+ // no if() check here?
+ CPluginManager::GetInstance().OpenDebug(
+ GetHandle(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
+ );
+
+
+ }
}
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
+
+ // =======================================================================================
+ // Windowses
+ // ---------------
wxMenuBar* pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
{
@@ -245,19 +319,29 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
if (IsLoggingActivated())
{
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
- pLogWindow->Check(true);
+ pLogWindow->Check(bLogWindow);
}
wxMenuItem* pRegister = pDebugDialogs->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
- pRegister->Check(true);
+ pRegister->Check(bRegisterWindow);
wxMenuItem* pBreakPoints = pDebugDialogs->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"), wxEmptyString, wxITEM_CHECK);
- pBreakPoints->Check(true);
+ pBreakPoints->Check(bBreakpointWindow);
wxMenuItem* pMemory = pDebugDialogs->Append(IDM_MEMORYWINDOW, _T("&Memory"), wxEmptyString, wxITEM_CHECK);
- pMemory->Check(true);
+ pMemory->Check(bMemoryWindow);
+
+ wxMenuItem* pJit = pDebugDialogs->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK);
+ pJit->Check(bJitWindow);
+
+ if (IsLoggingActivated()) {
+ wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString, wxITEM_CHECK);
+ pSound->Check(bSoundWindow);}
+
pMenuBar->Append(pDebugDialogs, _T("&Views"));
}
+ // ===============
+
{
wxMenu *pSymbolsMenu = new wxMenu;
@@ -665,10 +749,18 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
{
+
if (IsLoggingActivated())
{
bool show = GetMenuBar()->IsChecked(event.GetId());
+ // this may be a little ugly to have these here - you're more than welcome to
+ // turn this into the same fancy class stuff like the load windows positions
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "LogWindow", show);
+ ini.Save("Debugger.ini");
+
if (show)
{
if (!m_LogWindow)
@@ -699,6 +791,11 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
{
bool show = GetMenuBar()->IsChecked(event.GetId());
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "RegisterWindow", show);
+ ini.Save("Debugger.ini");
+
if (show)
{
if (!m_RegisterWindow)
@@ -723,10 +820,79 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
}
}
+
+// =======================================================================================
+// Toggle Sound Debugging Window
+// ------------
+void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
+{
+ bool show = GetMenuBar()->IsChecked(event.GetId());
+
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "SoundWindow", show);
+ ini.Save("Debugger.ini");
+
+
+ if (IsLoggingActivated() && show)
+ {
+ // TODO: add some kind of if?
+ CPluginManager::GetInstance().OpenDebug(
+ GetHandle(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
+ );
+ }
+ else // hide
+ {
+ // can we close the dll window from here?
+ }
+}
+// ===========
+
+
+void CCodeWindow::OnToggleJitWindow(wxCommandEvent& event)
+{
+ bool show = GetMenuBar()->IsChecked(event.GetId());
+
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "JitWindow", show);
+ ini.Save("Debugger.ini");
+
+ if (show)
+ {
+ if (!m_JitWindow)
+ {
+ m_JitWindow = new CJitWindow(this);
+ }
+
+ m_JitWindow->Show(true);
+ }
+ else // hide
+ {
+ // If m_dialog is NULL, then possibly the system
+ // 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_JitWindow != NULL);
+
+ if (m_JitWindow)
+ {
+ m_JitWindow->Hide();
+ }
+ }
+}
+
+
void CCodeWindow::OnToggleBreakPointWindow(wxCommandEvent& event)
{
bool show = GetMenuBar()->IsChecked(event.GetId());
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "BreakpointWindow", show);
+ ini.Save("Debugger.ini");
+
if (show)
{
if (!m_BreakpointWindow)
@@ -754,6 +920,11 @@ void CCodeWindow::OnToggleBreakPointWindow(wxCommandEvent& event)
void CCodeWindow::OnToggleMemoryWindow(wxCommandEvent& event)
{
bool show = GetMenuBar()->IsChecked(event.GetId());
+
+ IniFile ini;
+ ini.Load("Debugger.ini");
+ ini.Set("ShowOnStart", "MemoryWindow", show);
+ ini.Save("Debugger.ini");
if (show)
{
@@ -803,7 +974,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
{
m_RegisterWindow->NotifyUpdate();
}
-
break;
case IDM_UPDATEBREAKPOINTS:
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h
index 4981b0f5f1..e39e9c8427 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.h
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.h
@@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
+
#ifndef CODEWINDOW_H_
#define CODEWINDOW_H_
@@ -83,6 +84,8 @@ class CCodeWindow
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_MEMORYWINDOW,
+ IDM_SOUNDWINDOW, // sound
+ IDM_JITWINDOW, // jit
IDM_SCANFUNCTIONS,
IDM_LOGINSTRUCTIONS,
IDM_LOADMAPFILE,
@@ -143,6 +146,9 @@ class CCodeWindow
void OnToggleBreakPointWindow(wxCommandEvent& event);
void OnToggleLogWindow(wxCommandEvent& event);
void OnToggleMemoryWindow(wxCommandEvent& event);
+ void OnToggleJitWindow(wxCommandEvent& event);
+ void OnToggleSoundWindow(wxCommandEvent& event);
+
void OnHostMessage(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp
index af97bd29f9..264a1fd4b6 100644
--- a/Source/Core/DolphinWX/Src/Main.cpp
+++ b/Source/Core/DolphinWX/Src/Main.cpp
@@ -103,12 +103,15 @@ bool DolphinApp::OnInit()
}
#endif
+ // ============
+ // Check for debugger
bool UseDebugger = false;
#if wxUSE_CMDLINE_PARSER
wxCmdLineEntryDesc cmdLineDesc[] =
{
- {wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP},
+ {wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"), wxCMD_LINE_VAL_NONE,
+ wxCMD_LINE_OPTION_HELP},
{wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")},
{wxCMD_LINE_NONE}
};
@@ -123,6 +126,7 @@ bool DolphinApp::OnInit()
}
UseDebugger = parser.Found(_T("debugger"));
+ // ============
#endif
SConfig::GetInstance().LoadSettings();
@@ -141,8 +145,32 @@ bool DolphinApp::OnInit()
const char *title = "Dolphin SVN Linux";
#endif
#endif
- main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
- wxPoint(100, 100), wxSize(800, 600));
+
+ // ---------------------------------------------------------------------------------------
+ // If we are debugging let use save the main window position and size
+ // TODO: Save position and size on exit
+ // ---------
+ IniFile ini;
+ ini.Load("Debugger.ini");
+
+ int x, y, w, h;
+
+ ini.Get("MainWindow", "x", &x, 100);
+ ini.Get("MainWindow", "y", &y, 100);
+ ini.Get("MainWindow", "w", &w, 600);
+ ini.Get("MainWindow", "h", &h, 800);
+ // ---------
+ if(UseDebugger)
+ {
+ main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
+ wxPoint(x, y), wxSize(h, w));
+ }
+ else
+ {
+ main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
+ wxPoint(100, 100), wxSize(800, 600));
+ }
+ // ---------
// create debugger
if (UseDebugger)
diff --git a/Source/Core/DolphinWX/Src/PluginManager.cpp b/Source/Core/DolphinWX/Src/PluginManager.cpp
index bd00c956ab..918c7b7fe6 100644
--- a/Source/Core/DolphinWX/Src/PluginManager.cpp
+++ b/Source/Core/DolphinWX/Src/PluginManager.cpp
@@ -118,6 +118,15 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
}
}
+void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename)
+{
+ if (Common::CPlugin::Load(_rFilename))
+ {
+ Common::CPlugin::Debug((HWND)_Parent);
+ Common::CPlugin::Release();
+ }
+}
+
CPluginInfo::CPluginInfo(const char *_rFileName)
: m_FileName(_rFileName)
, m_Valid(false)
diff --git a/Source/Core/DolphinWX/Src/PluginManager.h b/Source/Core/DolphinWX/Src/PluginManager.h
index 4ce0322616..d34302f5fe 100644
--- a/Source/Core/DolphinWX/Src/PluginManager.h
+++ b/Source/Core/DolphinWX/Src/PluginManager.h
@@ -43,6 +43,7 @@ public:
void ScanForPlugins(wxWindow* _wxWindow);
void OpenAbout(void* _Parent, const char *_rFilename);
void OpenConfig(void* _Parent, const char *_rFilename);
+ void OpenDebug(void* _Parent, const char *_rFilename);
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
private:
diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln
index 7cb910a910..612d104b53 100644
--- a/Source/Dolphin.sln
+++ b/Source/Dolphin.sln
@@ -92,6 +92,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL", "Plugins\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_HLE", "Plugins\Plugin_DSP_HLE\Plugin_DSP_HLE.vcproj", "{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}"
ProjectSection(ProjectDependencies) = postProject
+ {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}
+ {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0}
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject
diff --git a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
index 8132bfd768..0d5d2c5e08 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
+++ b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
@@ -131,7 +131,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
new file mode 100644
index 0000000000..98c574004c
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
@@ -0,0 +1,193 @@
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+// Licensetype: GNU General Public License (GPL)
+//
+// 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/
+//
+//////////////////////////////////////////////////////////////////////////////////////////
+
+#include "Debugger.h"
+#include "PBView.h"
+#include "IniFile.h"
+
+
+
+// =======================================================================================
+// Declare events
+BEGIN_EVENT_TABLE(CDebugger,wxDialog)
+ EVT_CLOSE(CDebugger::OnClose)
+ EVT_BUTTON(ID_UPD,CDebugger::OnUpdate)
+END_EVENT_TABLE()
+// =======================================================================================
+
+
+CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
+ const wxPoint &position, const wxSize& size, long style)
+ : wxDialog(parent, id, title, position, size, style)
+ , m_GPRListView(NULL)
+{
+ CreateGUIControls();
+
+ // load ini...
+ IniFile file;
+ file.Load("Debugger.ini");
+ this->Load(file);
+}
+
+CDebugger::~CDebugger()
+{
+ // empty
+ IniFile file;
+ file.Load("Debugger.ini");
+
+ this->Save(file);
+ file.Save("Debugger.ini");
+}
+
+void CDebugger::Save(IniFile& _IniFile) const
+{
+ _IniFile.Set("SoundWindow", "x", GetPosition().x);
+ _IniFile.Set("SoundWindow", "y", GetPosition().y);
+ _IniFile.Set("SoundWindow", "w", GetSize().GetWidth());
+ _IniFile.Set("SoundWindow", "h", GetSize().GetHeight());
+}
+
+
+void CDebugger::Load(IniFile& _IniFile)
+{
+ int x,y,w,h;
+ _IniFile.Get("SoundWindow", "x", &x, GetPosition().x);
+ _IniFile.Get("SoundWindow", "y", &y, GetPosition().y);
+ _IniFile.Get("SoundWindow", "w", &w, GetSize().GetWidth());
+ _IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight());
+ SetSize(x, y, w, h);
+}
+
+void CDebugger::CreateGUIControls()
+{
+SetTitle(wxT("Sound Debugging"));
+ SetIcon(wxNullIcon);
+ SetSize(8, 8, 400, 370);
+ Center();
+
+ m_GPRListView = new CPBView(this, ID_GPR, wxDefaultPosition, GetSize(),
+ wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING);
+
+ wxBoxSizer* sMain;
+ wxButton* m_Upd;
+ wxButton* m_SelC;
+ wxButton* m_Presets;
+
+ wxStaticBoxSizer* sLeft;
+
+ wxListCtrl* m_MemcardList[2];
+ wxTimer* m_Timer;
+
+
+ // declarations
+ wxCheckBox *m_Check[2];
+ wxRadioButton *m_Radio[6];
+ wxPanel *m_Controller;
+
+ // checkboxes
+ m_Check[0] = new wxCheckBox(this, IDC_CHECK0, wxT("Save to file"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Check[1] = new wxCheckBox(this, IDC_CHECK1, wxT("Show updated"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+
+
+ m_Radio[0] = new wxRadioButton(this, IDC_RADIO0, wxT("Show base 10"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Radio[1] = new wxRadioButton(this, IDC_RADIO1, wxT("Show base 16"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+
+
+ m_Radio[2] = new wxRadioButton(this, IDC_RADIO2, wxT("Never"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Radio[3] = new wxRadioButton(this, IDC_RADIO3, wxT("5 times/s"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Radio[4] = new wxRadioButton(this, IDC_RADIO4, wxT("10 times/s"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+
+
+ m_Upd = new wxButton(this, ID_UPD, wxT("Update"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_SelC = new wxButton(this, ID_SELC, wxT("Select Columns"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+ m_Presets = new wxButton(this, ID_PRESETS, wxT("Presets"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
+
+ sLeft = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Current Status"));
+
+
+ wxBoxSizer* sButtons;
+ sButtons = new wxBoxSizer(wxVERTICAL);
+
+ sButtons->AddStretchSpacer(1);
+
+ sButtons->Add(m_Upd, 0, 0, 5);
+ sButtons->Add(m_SelC, 0, 0, 5);
+ sButtons->Add(m_Presets, 0, 0, 5);
+
+ sButtons->AddStretchSpacer(1);
+
+ sButtons->Add(m_Check[0], 0, 0, 5);
+ sButtons->Add(m_Check[1], 0, 0, 5);
+
+ sButtons->AddStretchSpacer(1);
+
+ sButtons->Add(m_Radio[0], 0, 0, 5);
+ sButtons->Add(m_Radio[1], 0, 0, 5);
+
+ sButtons->AddStretchSpacer(1);
+
+ sButtons->Add(m_Radio[2], 0, 0, 5);
+ sButtons->Add(m_Radio[3], 0, 0, 5);
+ sButtons->Add(m_Radio[4], 0, 0, 5);
+
+ sButtons->AddStretchSpacer(1);
+
+
+ sLeft->Add(m_GPRListView, 1, wxEXPAND|wxALL, 5);
+
+
+ sMain = new wxBoxSizer(wxHORIZONTAL);
+ sMain->Add(sLeft, 1, wxEXPAND|wxALL, 5);
+ sMain->Add(sButtons, 0, wxEXPAND, 0);
+
+ this->SetSizer(sMain);
+ sMain->SetSizeHints(this);
+
+ NotifyUpdate();
+}
+
+void CDebugger::OnClose(wxCloseEvent& /*event*/)
+{
+ EndModal(0);
+}
+
+void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
+{
+ this->NotifyUpdate();
+}
+
+void CDebugger::NotifyUpdate()
+{
+ if (m_GPRListView != NULL)
+ {
+ m_GPRListView->Update();
+ }
+}
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h
new file mode 100644
index 0000000000..82039b4731
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h
@@ -0,0 +1,85 @@
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+// Licensetype: GNU General Public License (GPL)
+//
+// 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/
+//
+//////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __CDebugger_h__
+#define __CDebugger_h__
+
+
+#include "../Globals.h"
+
+class CPBView;
+class IniFile;
+
+// =======================================================================================
+// Window settings - I'm not sure what these do. I just copied them gtom elsewhere basically.
+#undef CDebugger_STYLE
+
+#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
+// =======================================================================================
+
+class CDebugger : public wxDialog
+{
+ private:
+ DECLARE_EVENT_TABLE();
+
+ public:
+ CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Sound Debugger"),
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = CDebugger_STYLE);
+
+ virtual ~CDebugger();
+
+ void Save(IniFile& _IniFile) const;
+ void Load(IniFile& _IniFile);
+
+ void NotifyUpdate();
+ void OnUpdate(wxCommandEvent& event);
+
+ CPBView* m_GPRListView;
+
+
+ private:
+ // ---------------------------------------------------------------------------------------
+ // WARNING: Make sure these are not also elsewhere, for example in resource.h.
+ enum
+ {
+ IDC_CHECK0 = 2000,
+ IDC_CHECK1,
+ IDC_RADIO0,
+ IDC_RADIO1,
+ IDC_RADIO2,
+ IDC_RADIO3,
+ IDC_RADIO4,
+ ID_UPD,
+ ID_SELC,
+ ID_PRESETS,
+ ID_GPR,
+ ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
+
+ };
+ // ---------------------------------------------------------------------------------------
+
+
+ void OnClose(wxCloseEvent& event);
+ void CreateGUIControls();
+};
+
+#endif
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.cpp
new file mode 100644
index 0000000000..f8448dfef3
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.cpp
@@ -0,0 +1,168 @@
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// 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/
+
+
+#include "PBView.h"
+
+#include
+#include
+
+
+
+// ---------------------------------------------------------------------------------------
+// external declarations
+extern const char* GetGRPName(unsigned int index);
+
+// No buttons or events so far
+BEGIN_EVENT_TABLE(CPBView, wxListCtrl)
+
+END_EVENT_TABLE()
+// ---------------------------------------------------------------------------------------
+
+
+
+CPBView::CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
+ : wxListCtrl(parent, id, pos, size, style)
+{
+ InsertColumn(1, wxT("upd4"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("upd3"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("upd2"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("upd1"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("upd0"), wxLIST_FORMAT_LEFT, 90);
+
+ InsertColumn(1, wxT("r_lo"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("r_hi"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("ratio"), wxLIST_FORMAT_LEFT, 90);
+
+ InsertColumn(1, wxT("frac"), wxLIST_FORMAT_LEFT, 90);
+
+ InsertColumn(1, wxT("coef"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("src_t"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("form"), wxLIST_FORMAT_LEFT, 90);
+
+ InsertColumn(1, wxT("isstr"), wxLIST_FORMAT_LEFT, 90);
+
+ InsertColumn(1, wxT("yn2"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("yn1"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("pred_s"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("isloop"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("volr"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("voll"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("loopto"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(1, wxT("end"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(0, wxT("pos"), wxLIST_FORMAT_LEFT, 90);
+ InsertColumn(0, wxT("run"), wxLIST_FORMAT_RIGHT, 50);
+ InsertColumn(0, wxT("Block"), wxLIST_FORMAT_CENTER, 40);
+
+ SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Segoe UI")));
+
+ for (int i = 0; i < 64; i++)
+ {
+
+ // Print values from 0 to 63
+ char buffer [33];
+ itoa(i, buffer, 10);
+ sprintf(buffer, "%02i", i);
+ int Item = InsertItem(0, buffer);
+
+
+ wxListItem item;
+ item.SetId(Item);
+ item.SetBackgroundColour(0xFFFFFF);
+ item.SetData(i);
+ SetItem(item);
+ }
+
+ // This is a wx call that leads to MSWDrawSubItem
+ Refresh();
+}
+
+
+void
+CPBView::Update()
+{
+
+ Refresh();
+
+}
+
+
+bool
+CPBView::MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem)
+{
+ bool Result = false;
+
+ // don't change 0, it has the block values
+ if(subitem > 0)
+ {
+//#ifdef __WXMSW__ // what's this? should I use that?
+
+ // =======================================================================================
+ const wxChar* bgColor = _T("#ffffff");
+ wxBrush bgBrush(bgColor);
+ wxPen bgPen(bgColor);
+
+ wxRect SubItemRect;
+ this->GetSubItemRect(item, subitem, SubItemRect);
+ rPainDC.SetBrush(bgBrush);
+ rPainDC.SetPen(bgPen);
+ rPainDC.DrawRectangle(SubItemRect);
+ // =======================================================================================
+
+ // =======================================================================================
+ // A somewhat primitive attempt to show the playing history for a certain block.
+ // ---------------------------------------------------------------------------------------
+ wxString text;
+ // ---------------------------------------------------------------------------------------
+ if(subitem == 1)
+ {
+ char cbuff [33];
+
+ sprintf(cbuff, "%08i", m_CachedRegs[subitem][item]);
+ std::string c = cbuff;
+ int n[8];
+
+ for (int j = 0; j < 8; j++)
+ {
+
+ n[j] = atoi( c.substr(j, 1).c_str());
+ // 149 = dot, 160 = space
+ if (n[j] == 1){
+ n[j] = 149;} else {n[j] = 160;}
+ }
+ // pretty neat huh?
+ text.Printf(wxT("%c%c%c%c%c%c%c%c"), n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);
+
+ }
+ else
+ {
+ text.Printf(wxT("0x%08x"), m_CachedRegs[subitem][item]);
+ }
+ rPainDC.DrawText(text, SubItemRect.GetLeft() + 10, SubItemRect.GetTop() + 4);
+ // =======================================================================================
+
+
+ return(true);
+ }
+ else
+ {
+ // what does this mean?
+ return(Result);
+ }
+}
+
+
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h
new file mode 100644
index 0000000000..59a32cb6b8
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/PBView.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// 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/
+
+#ifndef __PBView_h__
+#define __PBView_h__
+
+#include
+
+#include "Common.h"
+
+class CPBView
+ : public wxListCtrl
+{
+ public:
+
+ CPBView(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
+
+ void Update();
+
+ u32 m_CachedRegs[64][92];
+
+
+ private:
+
+ DECLARE_EVENT_TABLE()
+
+ bool m_CachedRegHasChanged[64];
+
+ virtual bool MSWDrawSubItem(wxPaintDC& rPainDC, int item, int subitem);
+};
+
+#endif
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h
index cb514eb5a1..0ba54fd114 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Globals.h
@@ -1,6 +1,28 @@
#ifndef _GLOBALS_H
#define _GLOBALS_H
+
+// ---------------------------------------------------------------------------------------
+// wx stuff, I'm not sure if we use all these
+#ifndef WX_PRECOMP
+ #include
+ #include
+#else
+ #include
+#endif
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+// ------------
+
+
#include "Common.h"
#include "pluginspecs_dsp.h"
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp
new file mode 100644
index 0000000000..e628f2d37f
--- /dev/null
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Logging/Logging.cpp
@@ -0,0 +1,305 @@
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+// Licensetype: GNU General Public License (GPL)
+//
+// 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/
+//
+//////////////////////////////////////////////////////////////////////////////////////////
+
+
+// =======================================================================================
+// Includes
+// ---------------------------------------------------------------------------------------
+#include
+#include
+#include // so that we can test std::string == abc
+#include
+
+#include "Common.h"
+
+#include "../UCodes/UCodes.h"
+#include "../UCodes/UCode_AXStructs.h"
+#include "../UCodes/UCode_AX.h"
+
+#include "../Debugger/PBView.h"
+#include "../Debugger/Debugger.h"
+// =======================================================================================
+
+
+// =======================================================================================
+// Declarations
+// ---------------------------------------------------------------------------------------
+
+
+// ---------------------------------------------------------------------------------------
+// Externals
+// ---------------------------------------------------------------------------------------
+float ratioFactor; // a global to get the ratio factor from MixAdd
+// ---------------------------------------------------------------------------------------
+
+
+// =======================================================================================
+
+
+// ---------------------------------------------------------------------------------------
+// Parameter blocks
+// ---------------------------------------------------------------------------------------
+std::vector gloopPos(64);
+std::vector gsampleEnd(64);
+std::vector gsamplePos(64);
+// PBSampleRateConverter src
+ std::vector gratio(64);
+ std::vector gratiohi(64);
+ std::vector gratiolo(64);
+ std::vector gfrac(64);
+ std::vector gcoef(64);
+// PBSampleRateConverter mixer
+ std::vector gvolume_left(64);
+ std::vector gvolume_right(64);
+
+std::vector gaudioFormat(64);
+std::vector glooping(64);
+std::vector gsrc_type(64);
+std::vector gis_stream(64);
+
+// loop
+ std::vector gloop1(64);
+ std::vector gloop2(64);
+ std::vector gloop3(64);
+ std::vector gadloop1(64);
+ std::vector gadloop2(64);
+ std::vector gadloop3(64);
+
+// updates
+ std::vector gupdates1(64);
+ std::vector gupdates2(64);
+ std::vector gupdates3(64);
+ std::vector gupdates4(64);
+ std::vector gupdates5(64);
+ std::vector gupdates_addr(64);
+// ---------------------------------------------------------------------------------------
+
+
+// ---------------------------------------------------------------------------------------
+// Counters
+// ---------------------------------------------------------------------------------------
+int j = 0;
+int k = 0;
+__int64 l = 0;
+// ---------------------------------------------------------------------------------------
+
+
+// ---------------------------------------------------------------------------------------
+// More stuff
+// ---------------------------------------------------------------------------------------
+std::vector< std::vector > vector1(64, std::vector(100,0));
+int vectorLength = 8;
+std::vector vector62(vectorLength);
+std::vector vector63(vectorLength);
+// ---------------------------------------------------------------------------------------
+
+
+// ---------------------------------------------------------------------------------------
+// Classes
+// ---------------------------------------------------------------------------------------
+extern CDebugger* m_frame;
+// ---------------------------------------------------------------------------------------
+
+
+// I placed this in CUCode_AX because there was some kind of problem to call it otherwise,
+// I'm sure it's simple to fix but I couldn't.
+void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a)
+{
+
+ AXParamBlock PBs[NUMBER_OF_PBS];
+ int numberOfPBs = ReadOutPBs(PBs, NUMBER_OF_PBS);
+
+
+ // ---------------------------------------------------------------------------------------
+ // Control how often the screen is updated
+ j++;
+ l++;
+ if (j>20)
+ {
+
+ // =======================================================================================
+ // Move all items back - vector1 is a vector1[64][100] vector, I think
+ // ---------------------------------------------------------------------------------------
+ /*
+ 1 to 2
+ 2 3
+ 3
+ */
+ for (int i = 0; i < 64; i++)
+ {
+ for (int j = 1; j < vectorLength; j++)
+ {
+ vector1.at(i).at(j-1) = vector1.at(i).at(j);
+ }
+ }
+ // =======================================================================================
+
+
+ // ---------------------------------------------------------------------------------------
+ // Save the latest value
+ // ---------------------------------------------------------------------------------------
+ for (int i = 0; i < numberOfPBs; i++)
+ {
+ vector1.at(i).at(vectorLength-1) = PBs[i].running;
+ }
+ // ---------------------------------------------------------------------------------------
+
+
+ // =======================================================================================
+ // go through all blocks, or only some
+ for (int i = 0; i < numberOfPBs; i++)
+ {
+ //if (PBs[i].running)
+ //if (PBs[i].running && PBs[i].adpcm_loop_info.yn1 && PBs[i].mixer.volume_left)
+ if(true)
+ {
+
+ // =======================================================================================
+ // Playback history for the GUI debugger
+ // ---------------------------------------------------------------------------------------
+ std::string sbuff;
+
+ for (int j = 0; j < vectorLength; j++)
+ {
+ if(vector1.at(i).at(j) == 0)
+ {
+ sbuff = sbuff + "0";
+ }
+ else
+ {
+ sbuff = sbuff + "1";
+ }
+ }
+
+ u32 run = atoi( sbuff.c_str());
+ m_frame->m_GPRListView->m_CachedRegs[1][i] = run;
+ sbuff.clear();
+ // ================================================================================================
+
+ // We could chose to update these only if a block is currently running - Later I'll add options
+ // to see both the current and the lastets active value.
+ //if (PBs[i].running)
+ if (true)
+ {
+ // ---------------------------------------------------------------------------------------
+ // AXPB base
+ gcoef[i] = PBs[i].unknown1;
+
+ gloopPos[i] = (PBs[i].audio_addr.loop_addr_hi << 16) | PBs[i].audio_addr.loop_addr_lo;
+ gsampleEnd[i] = (PBs[i].audio_addr.end_addr_hi << 16) | PBs[i].audio_addr.end_addr_lo;
+ gsamplePos[i] = (PBs[i].audio_addr.cur_addr_hi << 16) | PBs[i].audio_addr.cur_addr_lo;
+
+ // PBSampleRateConverter src
+
+ gratio[i] = (u32)(((PBs[i].src.ratio_hi << 16) + PBs[i].src.ratio_lo) * ratioFactor);
+ gratiohi[i] = PBs[i].src.ratio_hi;
+ gratiolo[i] = PBs[i].src.ratio_lo;
+ gfrac[i] = PBs[i].src.cur_addr_frac;
+
+ // adpcm_loop_info
+ gadloop1[i] = PBs[i].adpcm.pred_scale;
+ gadloop2[i] = PBs[i].adpcm.yn1;
+ gadloop3[i] = PBs[i].adpcm.yn2;
+
+ gloop1[i] = PBs[i].adpcm_loop_info.pred_scale;
+ gloop2[i] = PBs[i].adpcm_loop_info.yn1;
+ gloop3[i] = PBs[i].adpcm_loop_info.yn2;
+
+ // updates
+ gupdates1[i] = PBs[i].updates.num_updates[0];
+ gupdates2[i] = PBs[i].updates.num_updates[1];
+ gupdates3[i] = PBs[i].updates.num_updates[2];
+ gupdates4[i] = PBs[i].updates.num_updates[3];
+ gupdates5[i] = PBs[i].updates.num_updates[4];
+
+ gupdates_addr[i] = (PBs[i].updates.data_hi << 16) | PBs[i].updates.data_lo;
+
+ gaudioFormat[i] = PBs[i].audio_addr.sample_format;
+ glooping[i] = PBs[i].audio_addr.looping;
+ gsrc_type[i] = PBs[i].src_type;
+ gis_stream[i] = PBs[i].is_stream;
+
+ // mixer
+ gvolume_left[i] = PBs[i].mixer.volume_left;
+ gvolume_right[i] = PBs[i].mixer.volume_right;
+ }
+
+ // ================================================================================================
+ // hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
+ if(m_frame)
+ {
+ m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i];
+ m_frame->m_GPRListView->m_CachedRegs[2][i] = gsampleEnd[i];
+ m_frame->m_GPRListView->m_CachedRegs[3][i] = gloopPos[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[4][i] = gvolume_left[i];
+ m_frame->m_GPRListView->m_CachedRegs[5][i] = gvolume_right[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[6][i] = glooping[i];
+ m_frame->m_GPRListView->m_CachedRegs[7][i] = gloop1[i];
+ m_frame->m_GPRListView->m_CachedRegs[8][i] = gloop2[i];
+ m_frame->m_GPRListView->m_CachedRegs[9][i] = gloop3[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[10][i] = gis_stream[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[11][i] = gaudioFormat[i];
+ m_frame->m_GPRListView->m_CachedRegs[12][i] = gsrc_type[i];
+ m_frame->m_GPRListView->m_CachedRegs[13][i] = gcoef[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[14][i] = gfrac[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[15][i] = gratio[i];
+ m_frame->m_GPRListView->m_CachedRegs[16][i] = gratiohi[i];
+ m_frame->m_GPRListView->m_CachedRegs[17][i] = gratiolo[i];
+
+ m_frame->m_GPRListView->m_CachedRegs[18][i] = gupdates1[i];
+ m_frame->m_GPRListView->m_CachedRegs[19][i] = gupdates2[i];
+ m_frame->m_GPRListView->m_CachedRegs[20][i] = gupdates3[i];
+ m_frame->m_GPRListView->m_CachedRegs[21][i] = gupdates4[i];
+ m_frame->m_GPRListView->m_CachedRegs[22][i] = gupdates5[i];
+ }
+
+ } // end of if (PBs[i].running)
+
+
+ } // end of big loop - for (int i = 0; i < numberOfPBs; i++)
+
+
+
+ // =======================================================================================
+ // New values are written so update - DISABLED - It flickered a lot, even worse than a
+ // console window. I'll add a console window later to show the current status.
+ //if(m_frame)
+ if(false)
+ {
+ //m_frame->NotifyUpdate();
+ }
+ // =======================================================================================
+
+ k=0;
+ j=0;
+
+ } // end of if (j>20)
+
+ // ---------------------------------------------------------------------------------------
+
+} // end of function
+// =======================================================================================
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
index 6416a54324..e0c8778ea7 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
@@ -28,6 +28,14 @@
#include "UCode_AXStructs.h"
#include "UCode_AX.h"
+#include "../Debugger/Debugger.h"
+// ---------------------------------------------------------------------------------------
+// Externals
+// -----------
+extern float ratioFactor;
+extern CDebugger* m_frame;
+// -----------
+
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler, bool wii)
: IUCode(_rMailHandler)
, m_addressPBs(0xFFFFFFFF)
@@ -126,11 +134,18 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// read out pbs
int numberOfPBs = ReadOutPBs(PBs, NUMBER_OF_PBS);
#ifdef _WIN32
- float ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
+ ratioFactor = 32000.0f / (float)DSound::DSound_GetSampleRate();
#else
float ratioFactor = 32000.0f / 44100.0f;
#endif
+ // write logging data to debugger
+ if(m_frame)
+ {
+ CUCode_AX::Logging(_pBuffer, _iSize, 0);
+ }
+
+
for (int i = 0; i < numberOfPBs; i++)
{
AXParamBlock& pb = PBs[i];
@@ -141,7 +156,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// Sequenced music fix - This seems to work allright. I'm not sure which detection method cause
// the least side effects, but pred_scale seems to be nice and simple. Please report any side
// effects.
- // ---------------------------------------------------------------------------------------
+ // ------------
if (!pb.running && pb.adpcm_loop_info.pred_scale)
/*
if (!pb.running &&
@@ -152,7 +167,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
{
pb.running = true;
}
- // =======================================================================================
+ // =============
@@ -164,9 +179,9 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
some kind of buzing or interference noise in the music. But it goes away, so I guess it's not a
big issue. Please report any side effects.
*/
- // ---------------------------------------------------------------------------------------
+ // ------------
const u32 sampleEnd = (pb.audio_addr.end_addr_hi << 16) | pb.audio_addr.end_addr_lo;
- if (sampleEnd > 0x80000000)
+ if (sampleEnd > 0x10000000)
{
pb.running = 0;
@@ -183,13 +198,13 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
pb.adpcm_loop_info.yn1 = 0;
pb.adpcm_loop_info.yn2 = 0;
}
- // =======================================================================================
+ // =============
if (pb.running)
{
// =======================================================================================
// Set initial parameters
- // ---------------------------------------------------------------------------------------
+ // ------------
//constants
const u32 loopPos = (pb.audio_addr.loop_addr_hi << 16) | pb.audio_addr.loop_addr_lo;
const u32 ratio = (u32)(((pb.src.ratio_hi << 16) + pb.src.ratio_lo) * ratioFactor);
@@ -197,7 +212,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
//variables
u32 samplePos = (pb.audio_addr.cur_addr_hi << 16) | pb.audio_addr.cur_addr_lo;
u32 frac = pb.src.cur_addr_frac;
- // =======================================================================================
+ // =============
@@ -208,17 +223,17 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
// ---------------------------------------------------------------------------------------
// Stream settings
// src_type = 2 (most other games have src_type = 0)
- // ---------------------------------------------------------------------------------------
+ // ------------
// Affected games:
// Baten Kaitos - Eternal Wings (2003)
// Baten Kaitos - Origins (2006)?
// ?
- // ---------------------------------------------------------------------------------------
+ // ------------
if(pb.src_type == 2)
{
pb.src.ratio_hi = 1;
}
- // =======================================================================================
+ // =============
// =======================================================================================
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h
index 7f8aedfda6..68e00eb885 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.h
@@ -30,6 +30,9 @@ public:
void MixAdd(short* _pBuffer, int _iSize);
void Update();
+ // this is a little ugly perhaps, feel free to move it out of here
+ void Logging(short* _pBuffer, int _iSize, int a);
+
private:
enum
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
index 4120beb64d..6d2fa99908 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
@@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
+// =======================================================================================
+// Includes
+// ------------------
#include "Common.h"
#include "Globals.h"
#include "ChunkFile.h"
@@ -33,6 +36,13 @@
#include "DSPHandler.h"
#include "Config.h"
+#include "Debugger/Debugger.h" // for the CDebugger class
+// ===================
+
+
+// =======================================================================================
+// DSP struct
+// -------------------
DSPInitialize g_dspInitialize;
u8* g_pMemory;
@@ -57,6 +67,23 @@ struct DSPState
};
DSPState g_dspState;
+// ====================
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// wxWidgets - Some kind of stuff wx needs
+// ŻŻŻŻŻŻŻŻŻ
+class wxDLLApp : public wxApp
+{
+ bool OnInit()
+ {
+ return true;
+ }
+};
+
+IMPLEMENT_APP_NO_MAIN(wxDLLApp)
+WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
+///////////////////
#ifdef _WIN32
@@ -69,9 +96,22 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
+ {
+
+ // more stuff wx needs
+ wxSetInstance((HINSTANCE)hinstDLL);
+ int argc = 0;
+ char **argv = NULL;
+ wxEntryStart(argc, argv);
+
+ // This is for ?
+ if ( !wxTheApp || !wxTheApp->CallOnInit() )
+ return FALSE;
+ }
break;
case DLL_PROCESS_DETACH:
+ wxEntryCleanup(); // use this or get a crash
break;
default:
@@ -84,10 +124,19 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
#endif
+// =======================================================================================
+// Create debugging window - We could use use wxWindow win; new CDebugger(win) like nJoy but I don't
+// know why it would be better. - There's a lockup problem with ShowModal(), but Show() doesn't work
+// because then DLL_PROCESS_DETACH is called immediately after DLL_PROCESS_ATTACH.
+// -------------------
+CDebugger* m_frame;
void DllDebugger(HWND _hParent)
{
- // TODO: implement
+ m_frame = new CDebugger(NULL);
+ m_frame->ShowModal();
}
+// ===================
+
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h
index 9188e4df98..347fa0133d 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/resource.h
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/resource.h
@@ -9,10 +9,10 @@
#define IDC_SAMPLERATE 1001
#define IDC_EDIT1 1002
#define IDC_SAMPLEDUMPPATH 1002
-#define IDC_CHECK1 1003
+//#define IDC_CHECK1 1003 // these conflicted with CDebugger
#define IDC_ENABLE_AUDIO 1003
#define IDC_ENABLE_HLE_AUDIO 1003
-#define IDC_CHECK2 1004
+//#define IDC_CHECK2 1004
#define IDC_ENABLE_DTK_MUSIC 1004
#define IDC_DUMPSAMPLES 1005
#define IDC_SAMPLEMINLENGTH 1006