Some changes to the debugger, added a DSP HLE debugging window. I moved the initialization of DLLdebugger from Core.cpp to the debugging window. (I hope this doesn't break the LLE debugger in any way, or does it have to be started right after LoadPlugin?). Also added a ShowOnStart saved setting to the debugger. And a MainWindow saved setting that set the position and size of the main window when it's started. I may have broken things in the debugger by allowing disabling of for example the Jit window. Please accept my apologies if that is the case.

There's an annoying problem with the DSP HLE wx window that blocks some input and places it in a queue. For example if you have loaded the window and press X on the main window, that action is blocked an placed in some kind of queue and not executed until you have closed the debugging window. This is also why the main Dolphin-Debugger window does not show up until you close the sound window. If someone find a fix to this I guess it could be convenient. There is another way to show the window, m_frame->Show() that is normally supposed to remove this kind of on-focus lock, but in a dll it seemingly breaks because it makes Dllmain call DLL_PROCESS_DETACH immediately after DLL_PROCESS_ATTACH so the window has to be killed or we crash.

Also, otherwise unnecessarily I had to disable the new DSP HLE debug window in Release mode because I could not access the SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str() string that I need to start it (if I tried it crashed). Very annoying and strange. I could not access m_strDSPPlugin or m_strVideoPlugin either, but all other values in m_LocalCoreStartupParameter seemed to work fine. I'll have to leave it to someone else to figure out why.

TODO: Later I'll add function to the debugging buttons, currently only update have a function. I'll add some option to show a custom console window (that actually worked better that the wx window to show the current parameters status, it had less flicker on frequent updates). I'll also add some custom log file saving option.

Also, the reason I placed Logging.cpp in its own dir is because I plan to add more files to it. There were problems with some build modes, win32 with debugging crashed on booting a game, I don't know if it's my fault. And I could not build Debug win64 because of some wx linking problem.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@722 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2008-09-29 03:19:23 +00:00
parent 6a54676914
commit f2a5fd1973
21 changed files with 1325 additions and 186 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -85,139 +85,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -246,7 +113,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -285,6 +152,71 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -312,7 +244,7 @@
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -350,6 +282,74 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="comctl32.lib rpcrt4.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
@ -378,7 +378,7 @@
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;;..\Common\Src;..\..\..\Externals\Bochs_disasm"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -508,14 +508,6 @@
Optimization="0"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -532,6 +524,14 @@
Optimization="0"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>

View File

@ -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:

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -131,7 +131,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include; ..\..\..\Externals\wxWidgets\Include\msvc;../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -220,7 +220,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -311,7 +311,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -400,7 +400,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="DEBUGFAST;WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -491,7 +491,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
AdditionalIncludeDirectories="..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;DEBUGFAST"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@ -712,6 +712,34 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
<File
RelativePath=".\Src\Debugger\Debugger.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\Debugger.h"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.cpp"
>
</File>
<File
RelativePath=".\Src\Debugger\PBView.h"
>
</File>
</Filter>
<Filter
Name="Logging"
>
<File
RelativePath=".\Src\Logging\Logging.cpp"
>
</File>
</Filter>
<File
RelativePath=".\Src\Config.cpp"
>

View File

@ -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();
}
}

View File

@ -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

View File

@ -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 <iostream>
#include <string>
// ---------------------------------------------------------------------------------------
// 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);
}
}

View File

@ -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 <wx/listctrl.h>
#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

View File

@ -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 <wx/wx.h>
#include <wx/dialog.h>
#else
#include <wx/wxprec.h>
#endif
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/statbmp.h>
#include <wx/sizer.h>
#include <wx/filepicker.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
// ------------
#include "Common.h"
#include "pluginspecs_dsp.h"

View File

@ -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 <iostream>
#include <vector>
#include <string> // so that we can test std::string == abc
#include <windows.h>
#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<u32> gloopPos(64);
std::vector<u32> gsampleEnd(64);
std::vector<u32> gsamplePos(64);
// PBSampleRateConverter src
std::vector<u32> gratio(64);
std::vector<u32> gratiohi(64);
std::vector<u32> gratiolo(64);
std::vector<u32> gfrac(64);
std::vector<u32> gcoef(64);
// PBSampleRateConverter mixer
std::vector<u16> gvolume_left(64);
std::vector<u16> gvolume_right(64);
std::vector<u16> gaudioFormat(64);
std::vector<u16> glooping(64);
std::vector<u16> gsrc_type(64);
std::vector<u16> gis_stream(64);
// loop
std::vector<u16> gloop1(64);
std::vector<u16> gloop2(64);
std::vector<u16> gloop3(64);
std::vector<u16> gadloop1(64);
std::vector<u16> gadloop2(64);
std::vector<u16> gadloop3(64);
// updates
std::vector<u16> gupdates1(64);
std::vector<u16> gupdates2(64);
std::vector<u16> gupdates3(64);
std::vector<u16> gupdates4(64);
std::vector<u16> gupdates5(64);
std::vector<u32> gupdates_addr(64);
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// Counters
// ---------------------------------------------------------------------------------------
int j = 0;
int k = 0;
__int64 l = 0;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// More stuff
// ---------------------------------------------------------------------------------------
std::vector< std::vector<int> > vector1(64, std::vector<int>(100,0));
int vectorLength = 8;
std::vector<u16> vector62(vectorLength);
std::vector<u16> 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
// =======================================================================================

View File

@ -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;
}
// =======================================================================================
// =============
// =======================================================================================

View File

@ -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

View File

@ -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)
{

View File

@ -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