remove WTL from dsp-lle testing and getting ready for wxw version of the debugger (anyone can do this :) )

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2789 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-03-29 21:00:26 +00:00
parent e2a9f8c3bb
commit 819b1e065d
28 changed files with 121 additions and 1708 deletions

View File

@ -154,7 +154,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioCommon", "Core\AudioCo
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_LLE_Test", "Plugins\Plugin_DSP_LLE-testing\Plugin_DSP_LLE_Test.vcproj", "{3D8156A9-64D1-4C8E-ADBE-1B319030E4A4}"
ProjectSection(ProjectDependencies) = postProject
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
{FBAFB369-07EB-4460-9CAD-08BE5789DAB6} = {FBAFB369-07EB-4460-9CAD-08BE5789DAB6}
{0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E}
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject

View File

@ -45,8 +45,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -68,7 +68,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/$(ProjectName)D.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -131,8 +131,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;_SECURE_SCL=0"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="1"
@ -154,7 +154,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/$(ProjectName)D.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -220,8 +220,8 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;_SECURE_SCL=0"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="2"
@ -242,7 +242,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -311,8 +311,8 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;_SECURE_SCL=0"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
@ -332,7 +332,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -399,8 +399,8 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;DEBUGFAST;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;DEBUGFAST;_SECURE_SCL=0"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="2"
UsePrecompiledHeader="2"
@ -421,7 +421,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/$(ProjectName)DF.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -490,8 +490,8 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs;../../Core/AudioCommon/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;DEBUGFAST;_SECURE_SCL=0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../PluginSpecs;../../Core/AudioCommon/Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_LLE_TEST_EXPORTS;DEBUGFAST;_SECURE_SCL=0"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
@ -511,7 +511,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/$(ProjectName)DF.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)"
@ -597,50 +597,6 @@
>
</File>
</Filter>
<Filter
Name="Debugger"
>
<File
RelativePath=".\Src\DisAsmDlg.cpp"
>
</File>
<File
RelativePath=".\Src\DisAsmDlg.h"
>
</File>
<File
RelativePath=".\Src\DisAsmListView.h"
>
</File>
<File
RelativePath=".\Src\RegisterDlg.cpp"
>
</File>
<File
RelativePath=".\Src\RegisterDlg.h"
>
</File>
<File
RelativePath=".\Src\RegSettings.cpp"
>
</File>
<File
RelativePath=".\Src\RegSettings.h"
>
</File>
</Filter>
<Filter
Name="Resources"
>
<File
RelativePath=".\Res\resource.h"
>
</File>
<File
RelativePath=".\Res\resources.rc"
>
</File>
</Filter>
<Filter
Name="DSP"
>
@ -766,17 +722,25 @@
</File>
</Filter>
<Filter
Name="PCHW"
Name="ConfigDialog"
>
<File
RelativePath=".\Src\Mixer.cpp"
RelativePath=".\Src\DSPConfigDlgLLE.cpp"
>
</File>
<File
RelativePath=".\Src\Mixer.h"
RelativePath=".\Src\DSPConfigDlgLLE.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\Config.cpp"
>
</File>
<File
RelativePath=".\Src\Config.h"
>
</File>
<File
RelativePath=".\Src\Globals.cpp"
>

View File

@ -17,16 +17,16 @@
#include "Config.h"
#include "ConfigDlg.h"
#include "DSPConfigDlgLLE.h"
BEGIN_EVENT_TABLE(ConfigDialog, wxDialog)
EVT_BUTTON(wxID_OK, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, ConfigDialog::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, ConfigDialog::SettingsChanged)
BEGIN_EVENT_TABLE(DSPConfigDialogLLE, wxDialog)
EVT_BUTTON(wxID_OK, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogLLE::SettingsChanged)
END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
// Load config settings
@ -73,18 +73,18 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
}
// Add audio output options
void ConfigDialog::AddBackend(const char* backend)
void DSPConfigDialogLLE::AddBackend(const char* backend)
{
m_BackendSelection->Append(wxString::FromAscii(backend));
// Update value
m_BackendSelection->SetValue(wxString::FromAscii(g_Config.sBackend.c_str()));
}
ConfigDialog::~ConfigDialog()
DSPConfigDialogLLE::~DSPConfigDialogLLE()
{
}
void ConfigDialog::SettingsChanged(wxCommandEvent& event)
void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event)
{
g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue();
g_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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
@ -15,26 +15,26 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __DSP_HLE_CONFIGDIALOG_h__
#define __DSP_HLE_CONFIGDIALOG_h__
#ifndef __DSP_LLE_CONFIGDIALOG_h__
#define __DSP_LLE_CONFIGDIALOG_h__
#include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/button.h>
#include <wx/statbox.h>
class ConfigDialog : public wxDialog
class DSPConfigDialogLLE : public wxDialog
{
public:
ConfigDialog(wxWindow *parent,
DSPConfigDialogLLE(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"),
const wxString &title = wxT("Dolphin DSP-LLE Plugin Settings"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog();
virtual ~DSPConfigDialogLLE();
void AddBackend(const char *backend);
private:
DECLARE_EVENT_TABLE();
@ -58,4 +58,4 @@ private:
void SettingsChanged(wxCommandEvent& event);
};
#endif //__DSP_HLE_CONFIGDIALOG_h__
#endif //__DSP_LLE_CONFIGDIALOG_h__

View File

@ -1,667 +0,0 @@
// 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 "stdafx.h"
#include "../res/resource.h"
#include "DisAsmDlg.h"
#include "gdsp_memory.h"
#include "gdsp_interpreter.h"
#include "disassemble.h"
#include "RegSettings.h"
CDisAsmDlg::CDisAsmDlg()
: m_CachedStepCounter(-1)
, m_CachedCR(-1)
, m_State(RUN)
, m_CachedUCodeCRC(-1)
{}
BOOL CDisAsmDlg::PreTranslateMessage(MSG* pMsg)
{
return(IsDialogMessage(pMsg));
}
BOOL CDisAsmDlg::OnIdle()
{
return(FALSE);
}
LRESULT CDisAsmDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CWindowSettings ws;
if (ws.Load("Software\\Dolphin\\DSP", "DisAsm"))
{
ws.ApplyTo(CWindow(m_hWnd), SW_SHOW);
}
m_DisAsmListViewCtrl.m_hWnd = GetDlgItem(IDC_DISASM_LIST);
UIAddChildWindowContainer(m_hWnd);
m_DisAsmListViewCtrl.AddColumn(_T("BP"), ColumnBP);
m_DisAsmListViewCtrl.AddColumn(_T("Function"), ColumnFunction);
m_DisAsmListViewCtrl.AddColumn(_T("Address"), ColumnAddress);
m_DisAsmListViewCtrl.AddColumn(_T("Mnenmomic"), ColumnMenmomic);
m_DisAsmListViewCtrl.AddColumn(_T("Opcode"), ColumnOpcode);
m_DisAsmListViewCtrl.AddColumn(_T("Ext"), ColumnExt);
m_DisAsmListViewCtrl.AddColumn(_T("Parameter"), ColumnParameter);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnBP, 25);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnFunction, 160);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnAddress, 55);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnMenmomic, 55);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnOpcode, 60);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnExt, 40);
m_DisAsmListViewCtrl.SetColumnWidth(ColumnParameter, 500);
m_DisAsmListViewCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_RegisterDlg.Create(m_hWnd);
UpdateDialog();
DlgResize_Init(true, false, WS_THICKFRAME);
return(TRUE);
}
LRESULT CDisAsmDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CWindowSettings ws;
ws.GetFrom(CWindow(m_hWnd));
ws.Save("Software\\Dolphin\\DSP", "DisAsm");
return(0);
}
LRESULT CDisAsmDlg::OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
m_State = STEP;
UpdateButtonTexts();
return(0);
}
LRESULT CDisAsmDlg::OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if ((m_State == RUN) || (m_State == RUN_START))
{
m_State = PAUSE;
}
else
{
m_State = RUN_START;
}
UpdateButtonTexts();
return(0);
}
LRESULT CDisAsmDlg::OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (m_RegisterDlg.IsWindowVisible())
{
m_RegisterDlg.ShowWindow(SW_HIDE);
}
else
{
m_RegisterDlg.ShowWindow(SW_SHOW);
}
UpdateButtonTexts();
return(0);
}
LRESULT CDisAsmDlg::OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{
int Index = m_DisAsmListViewCtrl.GetSelectedIndex();
if (Index != -1)
{
uint16 SelectedPC = static_cast<uint16>(m_DisAsmListViewCtrl.GetItemData(Index));
ToggleBreakPoint(SelectedPC);
}
RedrawDisAsmListView();
return(0);
}
LRESULT CDisAsmDlg::OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{
int Index = m_DisAsmListViewCtrl.GetSelectedIndex();
if (Index != -1)
{
uint16 SelectedPC = static_cast<uint16>(m_DisAsmListViewCtrl.GetItemData(Index));
g_dsp.pc = SelectedPC;
}
RedrawDisAsmListView();
return(0);
}
void CDisAsmDlg::CloseDialog(int nVal)
{
DestroyWindow();
::PostQuitMessage(nVal);
}
int CALLBACK CDisAsmDlg::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
return(lParam1 > lParam2);
}
void CDisAsmDlg::RebuildDisAsmListView()
{
if (!m_DisAsmListViewCtrl.IsWindow())
return;
m_DisAsmListViewCtrl.ShowWindow(SW_HIDE);
m_DisAsmListViewCtrl.DeleteAllItems();
char Buffer[256];
gd_globals_t gdg;
if (g_dsp.pc & 0x8000)
{
gdg.binbuf = g_dsp.irom;
}
else
{
gdg.binbuf = g_dsp.iram;
}
gdg.buffer = Buffer;
gdg.buffer_size = 256;
gdg.ext_separator = (char)0xff;
gdg.show_pc = false;
gdg.show_hex = false;
gdg.print_tabs = true;
gdg.decode_names = true;
gdg.decode_registers = true;
for (gdg.pc = 0; gdg.pc < DSP_IROM_SIZE;)
{
uint16 CurrentPC = gdg.pc;
if (g_dsp.pc & 0x8000)
{
CurrentPC |= 0x8000;
}
char Temp[256];
sprintf_s(Temp, 256, "0x%04x", CurrentPC);
char Temp2[256];
sprintf_s(Temp2, 256, "0x%04x", dsp_imem_read(CurrentPC));
char* pOpcode = gd_dis_opcode(&gdg);
const char* pParameter = NULL;
const char* pExtension = NULL;
size_t WholeString = strlen(pOpcode);
for (size_t i = 0; i < WholeString; i++)
{
if (pOpcode[i] == (char)0xff)
{
pOpcode[i] = 0x00;
pExtension = &pOpcode[i + 1];
}
if (pOpcode[i] == 0x09)
{
pOpcode[i] = 0x00;
pParameter = &pOpcode[i + 1];
}
}
const char* pFunctionName = NULL;
if (m_SymbolMap.find(CurrentPC) != m_SymbolMap.end())
{
pFunctionName = m_SymbolMap[CurrentPC].Name.c_str();
}
int Item = m_DisAsmListViewCtrl.AddItem(0, ColumnBP, _T(" "));
m_DisAsmListViewCtrl.AddItem(Item, ColumnFunction, pFunctionName);
m_DisAsmListViewCtrl.AddItem(Item, ColumnAddress, Temp);
m_DisAsmListViewCtrl.AddItem(Item, ColumnMenmomic, Temp2);
m_DisAsmListViewCtrl.AddItem(Item, ColumnOpcode, pOpcode);
m_DisAsmListViewCtrl.AddItem(Item, ColumnExt, pExtension);
if (!_stricmp(pOpcode, "CALL"))
{
uint32 FunctionAddress = -1;
sscanf(pParameter, "0x%04x", &FunctionAddress);
if (m_SymbolMap.find(FunctionAddress) != m_SymbolMap.end())
{
pParameter = m_SymbolMap[FunctionAddress].Name.c_str();
}
}
m_DisAsmListViewCtrl.AddItem(Item, ColumnParameter, pParameter);
m_DisAsmListViewCtrl.SetItemData(Item, CurrentPC);
}
m_DisAsmListViewCtrl.SortItems(CompareFunc, (LPARAM) this);
m_DisAsmListViewCtrl.ShowWindow(SW_SHOW);
}
void CDisAsmDlg::UpdateDisAsmListView()
{
if (g_dsp.dram == NULL)
{
return;
}
// check if we have to rebuild the list view
if (m_DisAsmListViewCtrl.GetItemCount() == 0)
{
RebuildDisAsmListView();
}
else
{
uint16 FirstPC = static_cast<uint16>(m_DisAsmListViewCtrl.GetItemData(0));
if ((FirstPC & 0x8000) != (g_dsp.pc & 0x8000))
{
RebuildDisAsmListView();
}
}
if (m_CachedStepCounter == g_dsp.step_counter)
{
return;
}
// show PC
for (int i = 0; i < m_DisAsmListViewCtrl.GetItemCount(); i++)
{
if (m_DisAsmListViewCtrl.GetItemData(i) == g_dsp.pc)
{
m_DisAsmListViewCtrl.EnsureVisible(i - 5, FALSE);
m_DisAsmListViewCtrl.EnsureVisible(i + 14, FALSE);
break;
}
}
m_CachedStepCounter = g_dsp.step_counter;
RedrawDisAsmListView();
m_RegisterDlg.UpdateRegisterListView();
}
void CDisAsmDlg::UpdateSymbolMap()
{
if (g_dsp.dram == NULL)
{
return;
}
if (m_CachedUCodeCRC != g_dsp.iram_crc)
{
// load symbol map (if there is one)
m_CachedUCodeCRC = g_dsp.iram_crc;
char FileName[MAX_PATH];
sprintf(FileName, "maps\\DSP_%08x.map", m_CachedUCodeCRC);
LoadSymbolMap(FileName);
// rebuild the disasm
RebuildDisAsmListView();
}
}
void CDisAsmDlg::UpdateRegisterFlags()
{
if (m_CachedCR == g_dsp.cr)
{
return;
}
CButton ButtonAssertInt(GetDlgItem(IDC_ASSERT_INT));
ButtonAssertInt.SetCheck(g_dsp.cr & 0x02 ? BST_CHECKED : BST_UNCHECKED);
CButton ButtonReset(GetDlgItem(IDC_HALT));
ButtonReset.SetCheck(g_dsp.cr & 0x04 ? BST_CHECKED : BST_UNCHECKED);
CButton ButtonInit(GetDlgItem(IDC_INIT));
ButtonInit.SetCheck(g_dsp.cr & 0x800 ? BST_CHECKED : BST_UNCHECKED);
m_CachedCR = g_dsp.cr;
}
bool CDisAsmDlg::CanDoStep()
{
UpdateSymbolMap(); // update the symbols all the time because there a script cmds like bps
switch (m_State)
{
case RUN_START:
m_State = RUN;
return(true);
case RUN:
if (IsBreakPoint(g_dsp.pc))
{
UpdateDialog();
m_State = PAUSE;
return(false);
}
return(true);
case PAUSE:
UpdateDialog();
return(false);
case STEP:
UpdateDialog();
m_State = PAUSE;
return(true);
}
return(false);
}
void CDisAsmDlg::DebugBreak()
{
m_State = PAUSE;
}
void CDisAsmDlg::UpdateButtonTexts()
{
// go button
{
CButton Button(GetDlgItem(ID_GO));
switch (m_State)
{
case RUN_START:
case RUN:
Button.SetWindowText("Pause");
break;
case PAUSE:
case STEP:
Button.SetWindowText("Go");
break;
}
}
// show register
{
CButton Button(GetDlgItem(ID_SHOW_REGISTER));
if (m_RegisterDlg.IsWindowVisible())
{
Button.SetWindowText("Hide Regs");
}
else
{
Button.SetWindowText("Show Regs");
}
}
}
bool CDisAsmDlg::IsBreakPoint(uint16 _Address)
{
return(std::find(m_BreakPoints.begin(), m_BreakPoints.end(), _Address) != m_BreakPoints.end());
}
void CDisAsmDlg::ToggleBreakPoint(uint16 _Address)
{
if (IsBreakPoint(_Address))
{
RemoveBreakPoint(_Address);
}
else
{
AddBreakPoint(_Address);
}
}
void CDisAsmDlg::RemoveBreakPoint(uint16 _Address)
{
CBreakPointList::iterator itr = std::find(m_BreakPoints.begin(), m_BreakPoints.end(), _Address);
if (itr != m_BreakPoints.end())
{
m_BreakPoints.erase(itr);
}
}
void CDisAsmDlg::AddBreakPoint(uint16 _Address)
{
CBreakPointList::iterator itr = std::find(m_BreakPoints.begin(), m_BreakPoints.end(), _Address);
if (itr == m_BreakPoints.end())
{
m_BreakPoints.push_back(_Address);
}
}
void CDisAsmDlg::ClearBreakPoints()
{
m_BreakPoints.clear();
}
LRESULT CDisAsmDlg::OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled)
{
int result = CDRF_DODEFAULT;
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pnmh);
switch (pLVCD->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
result = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
result = CDRF_NOTIFYSUBITEMDRAW;
break;
case (CDDS_ITEMPREPAINT | CDDS_SUBITEM):
{
pLVCD->nmcd.uItemState &= ~(CDIS_SELECTED | CDIS_FOCUS);
uint16 CurrentAddress = static_cast<uint16>(m_DisAsmListViewCtrl.GetItemData((int)pLVCD->nmcd.dwItemSpec));
pLVCD->clrTextBk = FindColor(CurrentAddress);
if (CurrentAddress == g_dsp.pc)
{
pLVCD->clrTextBk = RGB(96, 192, 128);
}
switch (pLVCD->iSubItem)
{
case 0x00:
{
if (IsBreakPoint(CurrentAddress))
{
pLVCD->clrTextBk = RGB(255, 64, 64);
}
}
break;
default:
break;
}
}
}
return(result);
}
void CDisAsmDlg::RedrawDisAsmListView()
{
::InvalidateRect(m_DisAsmListViewCtrl.m_hWnd, NULL, FALSE);
}
bool CDisAsmDlg::LoadSymbolMap(const char* _pFileName)
{
m_SymbolMap.clear();
FILE* pFile = fopen(_pFileName, "r");
if (!pFile)
{
return(false);
}
char Name[1024];
uint32 AddressStart, AddressEnd;
while (!feof(pFile))
{
char line[512];
fgets(line, 511, pFile);
if (strlen(line) < 2)
{
continue;
}
// check for comment
if (line[0] == '.')
{
continue;
}
// clear all breakpoints
if (line[0] == 'C')
{
ClearBreakPoints();
continue;
}
// add breakpoint
if (line[0] == 'B')
{
sscanf(line, "B %04x", &AddressStart);
AddBreakPoint(static_cast<uint16>(AddressStart));
continue;
}
// default add new symbol
sscanf(line, "%04x %04x %s", &AddressStart, &AddressEnd, Name);
if (m_SymbolMap.find(AddressStart) == m_SymbolMap.end())
{
m_SymbolMap.insert(std::pair<uint16, SSymbol>(AddressStart, SSymbol(AddressStart, AddressEnd, Name)));
}
else
{
m_SymbolMap[AddressStart] = SSymbol(AddressStart, AddressEnd, Name);
}
}
fclose(pFile);
return(true);
}
DWORD CDisAsmDlg::FindColor(uint16 _Address)
{
size_t Color = 0;
static int Colors[6] = {0xC0FFFF, 0xFFE0C0, 0xC0C0FF, 0xFFC0FF, 0xC0FFC0, 0xFFFFC0};
for (CSymbolMap::const_iterator itr = m_SymbolMap.begin(); itr != m_SymbolMap.end(); itr++)
{
const SSymbol& rSymbol = itr->second;
if ((rSymbol.AddressStart <= _Address) && (_Address <= rSymbol.AddressEnd))
{
return(Colors[Color % 6]);
}
Color++;
}
return(GetSysColor(COLOR_3DLIGHT));
}
void CDisAsmDlg::UpdateDialog()
{
UpdateSymbolMap();
UpdateDisAsmListView();
// UpdateButtonTexts();
UpdateRegisterFlags();
}
LRESULT CDisAsmDlg::OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
// TODO: Add your control notification handler code here
return 0;
}
// TODO: make the members adjust with the dialog
LRESULT CDisAsmDlg::OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
{
// we habe to make a group of the items I think
/*
CRect lpRect;
int wid = lpRect.right - lpRect.left - 100;
int hei = lpRect.bottom - lpRect.top - 20;
m_DisAsmListViewCtrl.ResizeClient(wid, hei, true);
*/
return 0;
}

View File

@ -1,163 +0,0 @@
// 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 "Globals.h"
#include <list>
#include <algorithm>
#include "../res/resource.h"
#include "DisAsmListView.h"
#include "RegisterDlg.h"
class CDisAsmDlg
: public CDialogImpl<CDisAsmDlg>, public CUpdateUI<CDisAsmDlg>, public CDialogResize<CDisAsmDlg>
{
public:
CDisAsmDlg();
enum { IDD = IDD_DISASMDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CDisAsmDlg)
END_UPDATE_UI_MAP()
BEGIN_DLGRESIZE_MAP(CDisAsmDlg)
DLGRESIZE_CONTROL(IDR_MAINFRAME, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
BEGIN_MSG_MAP(CDisAsmDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
COMMAND_ID_HANDLER(ID_STEP, OnStep)
COMMAND_ID_HANDLER(ID_GO, OnGo)
COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
NOTIFY_CODE_HANDLER(NM_CLICK, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RETURN, OnDblClick)
NOTIFY_CODE_HANDLER(NM_RCLICK, OnRClick)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
NOTIFY_HANDLER(IDC_DISASM_LIST, LVN_ITEMCHANGED, OnLvnItemchangedDisasmList)
MESSAGE_HANDLER(WM_SIZE, OnSize)
CHAIN_MSG_MAP(CDialogResize<CDisAsmDlg>)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
LRESULT OnDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
LRESULT OnRClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
bool CanDoStep();
void DebugBreak();
private:
enum EColumns
{
ColumnBP = 0,
ColumnFunction = 1,
ColumnAddress = 2,
ColumnMenmomic = 3,
ColumnOpcode = 4,
ColumnExt = 5,
ColumnParameter = 6
};
enum EState
{
PAUSE,
STEP,
RUN,
RUN_START // ignores breakpoints and switches after one step to RUN
};
EState m_State;
CListViewCtrl m_DisAsmListViewCtrl;
CRegisterDlg m_RegisterDlg;
//CWindow GroupLeft
CStatic GroupLeft;
uint64 m_CachedStepCounter;
uint16 m_CachedCR;
uint32 m_CachedUCodeCRC;
typedef std::list<uint16>CBreakPointList;
CBreakPointList m_BreakPoints;
// break point handling
bool IsBreakPoint(uint16 _Address);
void ToggleBreakPoint(uint16 _Address);
void RemoveBreakPoint(uint16 _Address);
void AddBreakPoint(uint16 _Address);
void ClearBreakPoints();
// update dialog
void UpdateDisAsmListView();
void UpdateRegisterFlags();
void UpdateSymbolMap();
void UpdateButtonTexts();
void RedrawDisAsmListView();
void RebuildDisAsmListView();
struct SSymbol
{
uint32 AddressStart;
uint32 AddressEnd;
std::string Name;
SSymbol(uint32 _AddressStart = 0, uint32 _AddressEnd = 0, char* _Name = NULL)
: AddressStart(_AddressStart)
, AddressEnd(_AddressEnd)
, Name(_Name)
{}
};
typedef std::map<uint16, SSymbol>CSymbolMap;
CSymbolMap m_SymbolMap;
void AddSymbol(uint16 _AddressStart, uint16 _AddressEnd, char* _Name);
bool LoadSymbolMap(const char* _pFileName);
DWORD FindColor(uint16 _Address);
void UpdateDialog();
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
public:
LRESULT OnLvnItemchangedDisasmList(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
};

View File

@ -1,64 +0,0 @@
// 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 _MYLISTVIEW_H
#define _MYLISTVIEW_H
class CDisAsmListView
: public CWindowImpl<CDisAsmListView, CListViewCtrl>,
public CCustomDraw<CDisAsmListView>
{
public:
BEGIN_MSG_MAP(CDisAsmListView)
CHAIN_MSG_MAP(CCustomDraw<CDisAsmListView>)
END_MSG_MAP()
DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/)
{
return(CDRF_NOTIFYITEMDRAW);
}
DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(lpNMCustomDraw);
// This is the prepaint stage for an item. Here's where we set the
// item's text color. Our return value will tell Windows to draw the
// item itself, but it will use the new color we set here for the background
COLORREF crText;
if ((pLVCD->nmcd.dwItemSpec % 2) == 0)
{
crText = RGB(200, 200, 255);
}
else
{
crText = RGB(255, 255, 255);
}
// Store the color back in the NMLVCUSTOMDRAW struct.
pLVCD->clrTextBk = crText;
// Tell Windows to paint the control itself.
return(CDRF_DODEFAULT);
}
};
#endif _MYLISTVIEW_H

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,274 +0,0 @@
// RegSettings.cpp
//
// Copyright (c) 2001 Magomed Abdurakhmanov
// maq@hotbox.ru, http://mickels.iwt.ru/en
//
//
//
// No warranties are given. Use at your own risk.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RegSettings.h"
//////////////////////////////////////////////////////////////////////
// CWindowSettings
#define S_WINDOW_PLACEMENT_VAL _T("WindowPlacement")
CWindowSettings::CWindowSettings()
{
m_WindowPlacement.length = sizeof(m_WindowPlacement);
m_WindowPlacement.flags = 0;
m_WindowPlacement.ptMinPosition.x = 0;
m_WindowPlacement.ptMinPosition.y = 0;
m_WindowPlacement.ptMaxPosition.x = 0;
m_WindowPlacement.ptMaxPosition.y = 0;
CRect rc;
SystemParametersInfo(SPI_GETWORKAREA, 0, rc, 0);
rc.DeflateRect(100, 100);
m_WindowPlacement.rcNormalPosition = rc;
m_WindowPlacement.showCmd = SW_SHOWNORMAL;
}
bool CWindowSettings::Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/)
{
CRegKey reg;
DWORD err = reg.Open(hkRootKey, szRegKey, KEY_READ);
if (err == ERROR_SUCCESS)
{
DWORD dwType = NULL;
DWORD dwSize = sizeof(m_WindowPlacement);
err = RegQueryValueEx(reg.m_hKey, CString(szPrefix) + S_WINDOW_PLACEMENT_VAL, NULL, &dwType,
(LPBYTE)&m_WindowPlacement, &dwSize);
}
return(err == ERROR_SUCCESS);
}
bool CWindowSettings::Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/) const
{
CRegKey reg;
DWORD err = reg.Create(hkRootKey, szRegKey);
if (err == ERROR_SUCCESS)
{
err = RegSetValueEx(reg.m_hKey, CString(szPrefix) + S_WINDOW_PLACEMENT_VAL, NULL, REG_BINARY,
(LPBYTE)&m_WindowPlacement, sizeof(m_WindowPlacement));
}
return(err == ERROR_SUCCESS);
}
void CWindowSettings::GetFrom(CWindow& Wnd)
{
ATLASSERT(Wnd.IsWindow());
Wnd.GetWindowPlacement(&m_WindowPlacement);
}
void CWindowSettings::ApplyTo(CWindow& Wnd, int nCmdShow /* = SW_SHOWNORMAL*/) const
{
ATLASSERT(Wnd.IsWindow());
Wnd.SetWindowPlacement(&m_WindowPlacement);
if (SW_SHOWNORMAL != nCmdShow)
{
Wnd.ShowWindow(nCmdShow);
}
else
if (m_WindowPlacement.showCmd == SW_MINIMIZE || m_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
{
Wnd.ShowWindow(SW_SHOWNORMAL);
}
}
//////////////////////////////////////////////////////////////////////
// CReBarSettings
#define S_BAR_BANDCOUNT _T("BandCount")
#define S_BAR_ID_VAL _T("ID")
#define S_BAR_CX_VAL _T("CX")
#define S_BAR_BREAKLINE_VAL _T("BreakLine")
CReBarSettings::CReBarSettings()
{
m_pBands = NULL;
m_cbBandCount = 0;
}
CReBarSettings::~CReBarSettings()
{
if (m_pBands != NULL)
{
delete[] m_pBands;
m_pBands = NULL;
}
}
bool CReBarSettings::Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/)
{
if (m_pBands != NULL)
{
delete[] m_pBands;
m_pBands = NULL;
}
m_pBands = NULL;
m_cbBandCount = 0;
CRegKey reg;
DWORD err = reg.Open(hkRootKey, szRegKey, KEY_READ);
if (err == ERROR_SUCCESS)
{
reg.QueryDWORDValue(CString(szPrefix) + S_BAR_BANDCOUNT, m_cbBandCount);
if (m_cbBandCount > 0)
{
m_pBands = new BandInfo[m_cbBandCount];
}
for (DWORD i = 0; i < m_cbBandCount; i++)
{
CString s;
s.Format(_T("%s%i_"), szPrefix, i);
reg.QueryDWORDValue(s + S_BAR_ID_VAL, m_pBands[i].ID);
reg.QueryDWORDValue(s + S_BAR_CX_VAL, m_pBands[i].cx);
DWORD dw;
reg.QueryDWORDValue(s + S_BAR_BREAKLINE_VAL, dw);
m_pBands[i].BreakLine = dw != 0;
}
}
return(err == ERROR_SUCCESS);
}
bool CReBarSettings::Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/) const
{
CRegKey reg;
DWORD err = reg.Create(hkRootKey, szRegKey);
if (err == ERROR_SUCCESS)
{
reg.SetDWORDValue(CString(szPrefix) + S_BAR_BANDCOUNT, m_cbBandCount);
for (DWORD i = 0; i < m_cbBandCount; i++)
{
CString s;
s.Format(_T("%s%i_"), szPrefix, i);
reg.SetDWORDValue(s + S_BAR_ID_VAL, m_pBands[i].ID);
reg.SetDWORDValue(s + S_BAR_CX_VAL, m_pBands[i].cx);
DWORD dw = m_pBands[i].BreakLine;
reg.SetDWORDValue(s + S_BAR_BREAKLINE_VAL, dw);
}
}
return(err == ERROR_SUCCESS);
}
void CReBarSettings::GetFrom(CReBarCtrl& ReBar)
{
ATLASSERT(ReBar.IsWindow());
if (m_pBands != NULL)
{
delete[] m_pBands;
}
m_pBands = NULL;
m_cbBandCount = ReBar.GetBandCount();
if (m_cbBandCount > 0)
{
m_pBands = new BandInfo[m_cbBandCount];
}
for (UINT i = 0; i < m_cbBandCount; i++)
{
REBARBANDINFO rbi;
rbi.cbSize = sizeof(rbi);
rbi.fMask = RBBIM_ID | RBBIM_SIZE | RBBIM_STYLE;
ReBar.GetBandInfo(i, &rbi);
m_pBands[i].ID = rbi.wID;
m_pBands[i].cx = rbi.cx;
m_pBands[i].BreakLine = (rbi.fStyle & RBBS_BREAK) != 0;
}
}
void CReBarSettings::ApplyTo(CReBarCtrl& ReBar) const
{
ATLASSERT(ReBar.IsWindow());
for (UINT i = 0; i < m_cbBandCount; i++)
{
ReBar.MoveBand(ReBar.IdToIndex(m_pBands[i].ID), i);
REBARBANDINFO rbi;
rbi.cbSize = sizeof(rbi);
rbi.fMask = RBBIM_ID | RBBIM_SIZE | RBBIM_STYLE;
ReBar.GetBandInfo(i, &rbi);
rbi.cx = m_pBands[i].cx;
if (m_pBands[i].BreakLine)
{
rbi.fStyle |= RBBS_BREAK;
}
else
{
rbi.fStyle &= (~RBBS_BREAK);
}
ReBar.SetBandInfo(i, &rbi);
}
}
//////////////////////////////////////////////////////////////////////
// CSplitterSettings
#define S_SPLITTER_POS _T("SplitterPos")
bool CSplitterSettings::Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/)
{
CRegKey reg;
DWORD err = reg.Open(hkRootKey, szRegKey, KEY_READ);
if (err == ERROR_SUCCESS)
{
reg.QueryDWORDValue(CString(szPrefix) + S_SPLITTER_POS, m_dwPos);
}
return(err == ERROR_SUCCESS);
}
bool CSplitterSettings::Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/) const
{
CRegKey reg;
DWORD err = reg.Create(hkRootKey, szRegKey);
if (err == ERROR_SUCCESS)
{
reg.SetDWORDValue(CString(szPrefix) + S_SPLITTER_POS, m_dwPos);
}
return(err == ERROR_SUCCESS);
}

View File

@ -1,81 +0,0 @@
// RegSettings.h
//
// Copyright (c) 2001 Magomed Abdurakhmanov
// maq@hotbox.ru, http://mickels.iwt.ru/en
//
//
//
// No warranties are given. Use at your own risk.
//
//////////////////////////////////////////////////////////////////////
#if !defined (AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)
#define AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <AtlMisc.h>
#include <AtlCtrls.h>
class CWindowSettings
{
public:
WINDOWPLACEMENT m_WindowPlacement;
CWindowSettings();
void GetFrom(CWindow& Wnd);
void ApplyTo(CWindow& Wnd, int nCmdShow = SW_SHOWNORMAL) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CReBarSettings
{
public:
struct BandInfo
{
DWORD ID;
DWORD cx;
bool BreakLine;
}* m_pBands;
DWORD m_cbBandCount;
CReBarSettings();
~CReBarSettings();
void GetFrom(CReBarCtrl& ReBar);
void ApplyTo(CReBarCtrl& ReBar) const;
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
class CSplitterSettings
{
public:
DWORD m_dwPos;
template<class T>void GetFrom(const T& Splitter)
{
m_dwPos = Splitter.GetSplitterPos();
}
template<class T>void ApplyTo(T& Splitter) const
{
Splitter.SetSplitterPos(m_dwPos);
}
bool Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER);
bool Save(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey = HKEY_CURRENT_USER) const;
};
#endif // !defined(AFX_REGSETTINGS_H__91E69C67_8104_4819_969A_B5E71A9993D5__INCLUDED_)

View File

@ -1,207 +0,0 @@
// 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 "../res/resource.h"
#include "RegisterDlg.h"
#include "disassemble.h"
#include "gdsp_interpreter.h"
#include "RegSettings.h"
CRegisterDlg::CRegisterDlg()
: m_CachedCounter(-1)
{}
BOOL CRegisterDlg::PreTranslateMessage(MSG* pMsg)
{
return(IsDialogMessage(pMsg));
}
BOOL CRegisterDlg::OnIdle()
{
return(FALSE);
}
LRESULT CRegisterDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CWindowSettings ws;
if (ws.Load("Software\\Dolphin\\DSP", "Register"))
{
ws.ApplyTo(CWindow(m_hWnd), SW_SHOW);
}
m_RegisterListViewCtrl.m_hWnd = GetDlgItem(IDC_DISASM_LIST);
UIAddChildWindowContainer(m_hWnd);
m_RegisterListViewCtrl.AddColumn(_T("General"), 0);
m_RegisterListViewCtrl.AddColumn(_T(" "), 1);
m_RegisterListViewCtrl.AddColumn(_T("Special"), 2);
m_RegisterListViewCtrl.AddColumn(_T("0"), 3);
m_RegisterListViewCtrl.SetColumnWidth(0, 50);
m_RegisterListViewCtrl.SetColumnWidth(1, 100);
m_RegisterListViewCtrl.SetColumnWidth(2, 60);
m_RegisterListViewCtrl.SetColumnWidth(3, 100);
m_RegisterListViewCtrl.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_RegisterListViewCtrl.SetTextBkColor(GetSysColor(COLOR_3DLIGHT));
for (uint16 i = 0; i < 16; i++)
{
// 0-15
int Item = m_RegisterListViewCtrl.AddItem(0, 0, gd_dis_get_reg_name(i));
// 16-31
m_RegisterListViewCtrl.AddItem(Item, 2, gd_dis_get_reg_name(16 + i));
// just for easy sort
m_RegisterListViewCtrl.SetItemData(Item, i);
}
m_RegisterListViewCtrl.SortItems(CompareFunc, (LPARAM) this);
UpdateRegisterListView();
return(TRUE);
}
LRESULT CRegisterDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CWindowSettings ws;
ws.GetFrom(CWindow(m_hWnd));
ws.Save("Software\\Dolphin\\DSP", "Register");
return(0);
}
void CRegisterDlg::UpdateRegisterListView()
{
if (m_CachedCounter == g_dsp.step_counter)
{
return;
}
m_CachedCounter = g_dsp.step_counter;
char Temp[256];
for (uint16 i = 0; i < 16; i++)
{
// 0-15
if (m_CachedRegs[i] != g_dsp.r[i])
{
m_CachedRegHasChanged[i] = true;
}
else
{
m_CachedRegHasChanged[i] = false;
}
m_CachedRegs[i] = g_dsp.r[i];
sprintf_s(Temp, 256, "0x%04x", g_dsp.r[i]);
m_RegisterListViewCtrl.SetItemText(i, 1, Temp);
// 16-31
if (m_CachedRegs[16 + i] != g_dsp.r[16 + i])
{
m_CachedRegHasChanged[16 + i] = true;
}
else
{
m_CachedRegHasChanged[16 + i] = false;
}
m_CachedRegs[16 + i] = g_dsp.r[16 + i];
sprintf_s(Temp, 256, "0x%04x", g_dsp.r[16 + i]);
m_RegisterListViewCtrl.SetItemText(i, 3, Temp);
}
}
int CALLBACK CRegisterDlg::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
return(lParam1 > lParam2);
}
LRESULT CRegisterDlg::OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled)
{
int result = CDRF_DODEFAULT;
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pnmh);
switch (pLVCD->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
result = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
result = CDRF_NOTIFYSUBITEMDRAW;
break;
case (CDDS_ITEMPREPAINT | CDDS_SUBITEM):
{
pLVCD->nmcd.uItemState &= ~(CDIS_SELECTED | CDIS_FOCUS);
int Offset = static_cast<int>(m_RegisterListViewCtrl.GetItemData((int)pLVCD->nmcd.dwItemSpec));
size_t Register = -1;
if (pLVCD->iSubItem == 1)
{
Register = Offset;
}
else if (pLVCD->iSubItem == 3)
{
Register = Offset + 16;
}
if (Register != -1)
{
if (m_CachedRegHasChanged[Register])
{
pLVCD->clrTextBk = RGB(0xFF, 192, 192);
}
else
{
pLVCD->clrTextBk = RGB(0xF0, 0xF0, 0xF0);
}
}
else
{
pLVCD->clrTextBk = RGB(192, 224, 192);
}
// uint16 CurrentAddress = static_cast<uint16>(m_DisAsmListViewCtrl.GetItemData((int)pLVCD->nmcd.dwItemSpec));
}
break;
}
return(result);
}

View File

@ -1,80 +0,0 @@
// 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/
#pragma once
#include "Globals.h"
#include <map>
#include "DisAsmListView.h"
class CRegisterDlg
: public CDialogImpl<CRegisterDlg>, public CUpdateUI<CRegisterDlg>
{
public:
CRegisterDlg();
enum { IDD = IDD_REGISTERDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CRegisterDlg)
END_UPDATE_UI_MAP()
BEGIN_MSG_MAP(CRegisterDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw)
// COMMAND_ID_HANDLER(ID_STEP, OnStep)
// COMMAND_ID_HANDLER(ID_GO, OnGo)
// COMMAND_ID_HANDLER(ID_SHOW_REGISTER, OnShowRegisters)
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& _bHandled);
// LRESULT OnStep(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnGo(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
// LRESULT OnShowRegisters(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
void CloseDialog(int nVal);
void UpdateRegisterListView();
private:
CListViewCtrl m_RegisterListViewCtrl;
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
uint64 m_CachedCounter;
uint16 m_CachedRegs[32];
bool m_CachedRegHasChanged[32];
};

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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
@ -26,22 +26,16 @@
#include "disassemble.h"
#include "Config.h"
#if defined(HAVE_WX) && HAVE_WX
#include "ConfigDlg.h"
#endif
#include "AudioCommon.h"
#include "Logging/Logging.h" // For Logging
#ifdef _WIN32
#include "DisAsmDlg.h"
HINSTANCE g_hInstance = NULL;
CDisAsmDlg g_Dialog;
#endif
#include "Thread.h"
#include "ChunkFile.h"
#if defined(HAVE_WX) && HAVE_WX
#include "DSPConfigDlgLLE.h"
#endif
PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize;
Common::Thread *g_hDSPThread;
@ -59,21 +53,53 @@ bool AXTask(u32& _uMail);
bool bCanWork = false;
//////////////////////////////////////////////////////////////////////////
// UGLY wxw stuff, TODO fix up
// wxWidgets: Create the wxApp
#if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp
{
bool OnInit()
{
return true;
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
// DllMain
#ifdef _WIN32
HINSTANCE g_hInstance = NULL;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_ATTACH:
{
case DLL_PROCESS_DETACH:
break;
// more stuff wx needs
wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0;
char **argv = NULL;
wxEntryStart(argc, argv);
default:
break;
// This is for ?
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); // use this or get a crash
break;
default:
break;
}
g_hInstance = hinstDLL;
@ -81,6 +107,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
}
#endif
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
@ -104,15 +131,15 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
}
void DllAbout(HWND _hParent)
{}
{
}
void DllConfig(HWND _hParent)
{
#if defined(HAVE_WX) && HAVE_WX
// (shuffle2) TODO: reparent dlg with DolphinApp
ConfigDialog dlg(NULL);
DSPConfigDialogLLE dlg(NULL);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
@ -128,23 +155,18 @@ void DllConfig(HWND _hParent)
}
void DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode)
{
PointerWrap p(ptr, mode);
}
void DllDebugger(HWND _hParent, bool Show)
{
#ifdef _WIN32
#if defined (_DEBUG) || defined (DEBUGFAST)
g_Dialog.Create(NULL); //_hParent);
g_Dialog.ShowWindow(SW_SHOW);
#endif
#endif
}
// Regular thread
void* dsp_thread(void* lpParameter)
THREAD_RETURN dsp_thread(void* lpParameter)
{
while (1)
{
@ -157,35 +179,13 @@ void* dsp_thread(void* lpParameter)
}
// Debug thread
void* dsp_thread_debug(void* lpParameter)
THREAD_RETURN dsp_thread_debug(void* lpParameter)
{
#ifdef _WIN32
while (1)
{
Logging(); // logging
if (g_Dialog.CanDoStep())
{
gdsp_runx(1);
}
else
{
Sleep(100);
}
}
#endif
return NULL;
return NULL;
}
void DSP_DebugBreak()
{
#ifdef _WIN32
#if defined(_DEBUG) || defined(DEBUGFAST)
g_Dialog.DebugBreak();
#endif
#endif
}
@ -331,18 +331,11 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
}
}
void DSP_Update(int cycles)
{
#ifdef _WIN32
if (g_Dialog.CanDoStep())
gdsp_runx(100); // cycles
#endif
soundStream->Update();
}
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
{
if (soundStream->GetMixer())
@ -371,5 +364,3 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
if ((counter & 31) == 0 && soundStream)
soundStream->Update();
}

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) 2003-2009 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
@ -23,14 +23,5 @@
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include "PluginSpecs_DSP.h"