Initial megacommit.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-12 17:40:22 +00:00
parent a3be5d89ae
commit 775dc8a9c0
1920 changed files with 734652 additions and 0 deletions

View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_LLE", "Plugin_DSP_LLE.vcproj", "{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|Win32.ActiveCfg = Debug|Win32
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|Win32.Build.0 = Debug|Win32
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|x64.ActiveCfg = Debug|x64
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|x64.Build.0 = Debug|x64
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Release|Win32.ActiveCfg = Release|Win32
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Release|Win32.Build.0 = Release|Win32
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Release|x64.ActiveCfg = Release|x64
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,791 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Plugin_DSP_LLE"
ProjectGUID="{C60D0E7A-ED05-4C67-9EE7-3A6C0D7801C8}"
RootNamespace="Plugin_DSP_LLE"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLE.dll"
LinkIncremental="2"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/DSP_HLE.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLED.dll"
LinkIncremental="2"
GenerateManifest="false"
GenerateDebugInformation="true"
AssemblyDebug="1"
ProgramDatabaseFile="$(OutDir)/DSP_HLE.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLE.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LEE.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLE.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
ManagedExtensions="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LEE.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
/>
<AssemblyReference
RelativePath="System.Drawing.dll"
AssemblyName="System.Drawing, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.Windows.Forms.dll"
AssemblyName="System.Windows.Forms, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
/>
</References>
<Files>
<Filter
Name="Disasm"
>
<File
RelativePath=".\Src\disassemble.cpp"
>
</File>
<File
RelativePath=".\Src\disassemble.h"
>
</File>
<File
RelativePath=".\Src\opcodes.cpp"
>
</File>
<File
RelativePath=".\Src\opcodes.h"
>
</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"
>
<File
RelativePath=".\Src\gdsp_aram.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_aram.h"
>
</File>
<File
RelativePath=".\Src\gdsp_ext_op.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_ext_op.h"
>
</File>
<File
RelativePath=".\Src\gdsp_ifx.h"
>
</File>
<File
RelativePath=".\Src\gdsp_interface.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_interface.h"
>
</File>
<File
RelativePath=".\Src\gdsp_interpreter.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_interpreter.h"
>
</File>
<File
RelativePath=".\Src\gdsp_memory.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_memory.h"
>
</File>
<File
RelativePath=".\Src\gdsp_opcodes.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_opcodes.h"
>
</File>
<File
RelativePath=".\Src\gdsp_opcodes_helper.h"
>
</File>
<File
RelativePath=".\Src\gdsp_registers.cpp"
>
</File>
<File
RelativePath=".\Src\gdsp_registers.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\DSoundStream.cpp"
>
</File>
<File
RelativePath=".\Src\DSoundStream.h"
>
</File>
<File
RelativePath=".\Src\Globals.cpp"
>
</File>
<File
RelativePath=".\Src\Globals.h"
>
</File>
<File
RelativePath=".\Src\main.cpp"
>
</File>
<File
RelativePath=".\Src\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\stdafx.h"
>
</File>
<File
RelativePath=".\Src\Tools.cpp"
>
</File>
<File
RelativePath=".\Src\Tools.h"
>
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="Res\resources.rc"
/>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,262 @@
// Windows Template Library - WTL version 8.0
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// This file is a part of the Windows Template Library.
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/osi3.0/licenses/cpl1.0.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.
#ifndef __ATLRES_H__
#define __ATLRES_H__
#pragma once
#if defined (_WIN32_WCE) && !defined (__ATLRESCE_H__)
#error Use atlresCE.h instead of atlres.h for Windows CE
#endif
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#ifndef _WIN32_WCE
#define VS_VERSION_INFO 1
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols
#endif // APSTUDIO_INVOKED
#ifndef WINVER
#define WINVER 0x0400 // default to Windows Version 4.0
#endif // !WINVER
#include <winresrc.h>
// operation messages sent to DLGINIT
#define LB_ADDSTRING (WM_USER + 1)
#define CB_ADDSTRING (WM_USER + 3)
#endif // !_WIN32_WCE
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1)
#endif // !_INC_WINDOWS
#endif // RC_INVOKED
#ifdef APSTUDIO_INVOKED
#define APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// ATL resource types
#ifndef RC_INVOKED
#define RT_DLGINIT MAKEINTRESOURCE(240)
#define RT_TOOLBAR MAKEINTRESOURCE(241)
#endif // RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
#undef APSTUDIO_HIDDEN_SYMBOLS
#endif // APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard window components
#define ID_SEPARATOR 0 // special separator value
#define ID_DEFAULT_PANE 0 // default status bar pane
#ifndef RC_INVOKED // code only
// standard control bars (IDW = window ID)
#define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window
#define ATL_IDW_STATUS_BAR 0xE801 // Status bar window
#define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window
// parts of a frame window
#define ATL_IDW_CLIENT 0xE900
#define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max)
#define ATL_IDW_PANE_LAST 0xE9FF
#define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
#define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
#define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters
#define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST
// bands for a rebar
#define ATL_IDW_BAND_FIRST 0xEB00
#define ATL_IDW_BAND_LAST 0xEBFF
#endif // !RC_INVOKED
///////////////////////////////////////////////////////////////////////////////
// Standard Commands
// File commands
#define ID_FILE_NEW 0xE100
#define ID_FILE_OPEN 0xE101
#define ID_FILE_CLOSE 0xE102
#define ID_FILE_SAVE 0xE103
#define ID_FILE_SAVE_AS 0xE104
#define ID_FILE_PAGE_SETUP 0xE105
#define ID_FILE_PRINT_SETUP 0xE106
#define ID_FILE_PRINT 0xE107
#define ID_FILE_PRINT_DIRECT 0xE108
#define ID_FILE_PRINT_PREVIEW 0xE109
#define ID_FILE_UPDATE 0xE10A
#define ID_FILE_SAVE_COPY_AS 0xE10B
#define ID_FILE_SEND_MAIL 0xE10C
#define ID_FILE_MRU_FIRST 0xE110
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
#define ID_FILE_MRU_FILE2 0xE111
#define ID_FILE_MRU_FILE3 0xE112
#define ID_FILE_MRU_FILE4 0xE113
#define ID_FILE_MRU_FILE5 0xE114
#define ID_FILE_MRU_FILE6 0xE115
#define ID_FILE_MRU_FILE7 0xE116
#define ID_FILE_MRU_FILE8 0xE117
#define ID_FILE_MRU_FILE9 0xE118
#define ID_FILE_MRU_FILE10 0xE119
#define ID_FILE_MRU_FILE11 0xE11A
#define ID_FILE_MRU_FILE12 0xE11B
#define ID_FILE_MRU_FILE13 0xE11C
#define ID_FILE_MRU_FILE14 0xE11D
#define ID_FILE_MRU_FILE15 0xE11E
#define ID_FILE_MRU_FILE16 0xE11F
#define ID_FILE_MRU_LAST 0xE11F
// Edit commands
#define ID_EDIT_CLEAR 0xE120
#define ID_EDIT_CLEAR_ALL 0xE121
#define ID_EDIT_COPY 0xE122
#define ID_EDIT_CUT 0xE123
#define ID_EDIT_FIND 0xE124
#define ID_EDIT_PASTE 0xE125
#define ID_EDIT_PASTE_LINK 0xE126
#define ID_EDIT_PASTE_SPECIAL 0xE127
#define ID_EDIT_REPEAT 0xE128
#define ID_EDIT_REPLACE 0xE129
#define ID_EDIT_SELECT_ALL 0xE12A
#define ID_EDIT_UNDO 0xE12B
#define ID_EDIT_REDO 0xE12C
// Window commands
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#ifndef RC_INVOKED // code only
#define ATL_IDM_WINDOW_FIRST 0xE130
#define ATL_IDM_WINDOW_LAST 0xE13F
#define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
#define ATL_IDM_LAST_MDICHILD 0xFFFD
#endif // !RC_INVOKED
// TabView
#define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD
#define ID_WINDOW_TABLAST 0xFFFD
#define ID_WINDOW_SHOWTABLIST 0xFFFE
// Help and App commands
#define ID_APP_ABOUT 0xE140
#define ID_APP_EXIT 0xE141
#define ID_HELP_INDEX 0xE142
#define ID_HELP_FINDER 0xE143
#define ID_HELP_USING 0xE144
#define ID_CONTEXT_HELP 0xE145 // shift-F1
// special commands for processing help
#define ID_HELP 0xE146 // first attempt for F1
#define ID_DEFAULT_HELP 0xE147 // last attempt
// Misc
#define ID_NEXT_PANE 0xE150
#define ID_PREV_PANE 0xE151
#define ID_PANE_CLOSE 0xE152
// Format
#define ID_FORMAT_FONT 0xE160
// Scroll
#define ID_SCROLL_UP 0xE170
#define ID_SCROLL_DOWN 0xE171
#define ID_SCROLL_PAGE_UP 0xE172
#define ID_SCROLL_PAGE_DOWN 0xE173
#define ID_SCROLL_TOP 0xE174
#define ID_SCROLL_BOTTOM 0xE175
#define ID_SCROLL_LEFT 0xE176
#define ID_SCROLL_RIGHT 0xE177
#define ID_SCROLL_PAGE_LEFT 0xE178
#define ID_SCROLL_PAGE_RIGHT 0xE179
#define ID_SCROLL_ALL_LEFT 0xE17A
#define ID_SCROLL_ALL_RIGHT 0xE17B
// OLE commands
#define ID_OLE_INSERT_NEW 0xE200
#define ID_OLE_EDIT_LINKS 0xE201
#define ID_OLE_EDIT_CONVERT 0xE202
#define ID_OLE_EDIT_CHANGE_ICON 0xE203
#define ID_OLE_EDIT_PROPERTIES 0xE204
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
#ifndef RC_INVOKED // code only
#define ID_OLE_VERB_LAST 0xE21F
#endif // !RC_INVOKED
// View commands (same number used as IDW used for toolbar and status bar)
#define ID_VIEW_TOOLBAR 0xE800
#define ID_VIEW_STATUS_BAR 0xE801
#define ID_VIEW_REFRESH 0xE803
///////////////////////////////////////////////////////////////////////////////
// Standard control IDs
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif // IDC_STATIC
#define IDC_STATIC (-1) // all static controls
///////////////////////////////////////////////////////////////////////////////
// Standard string error/warnings
// idle status bar message
#define ATL_IDS_IDLEMESSAGE 0xE001
#ifndef RC_INVOKED // code only
#define ATL_IDS_SCFIRST 0xEF00
#endif // !RC_INVOKED
#define ATL_IDS_SCSIZE 0xEF00
#define ATL_IDS_SCMOVE 0xEF01
#define ATL_IDS_SCMINIMIZE 0xEF02
#define ATL_IDS_SCMAXIMIZE 0xEF03
#define ATL_IDS_SCNEXTWINDOW 0xEF04
#define ATL_IDS_SCPREVWINDOW 0xEF05
#define ATL_IDS_SCCLOSE 0xEF06
#define ATL_IDS_SCRESTORE 0xEF12
#define ATL_IDS_SCTASKLIST 0xEF13
#define ATL_IDS_MDICHILD 0xEF1F
#define ATL_IDS_MRU_FILE 0xEFDA
///////////////////////////////////////////////////////////////////////////////
// Misc. control IDs
// Property Sheet control id's (determined with Spy++)
#define ID_APPLY_NOW 0x3021
#define ID_WIZBACK 0x3023
#define ID_WIZNEXT 0x3024
#define ID_WIZFINISH 0x3025
#define ATL_IDC_TAB_CONTROL 0x3020
#endif // __ATLRES_H__

View File

@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resources.rc
//
#define IDR_MAINFRAME 128
#define IDD_MAINDLG 129
#define IDD_DISASMDLG 129
#define IDD_DISASMDLG1 130
#define IDD_REGISTERDLG 130
#define IDC_LIST1 1000
#define IDC_DISASM_LIST 1000
#define ID_STEP 1001
#define ID_SHOW_REGISTER 1002
#define IDC_ASSERT_INT 1003
#define ID_GO 1004
#define IDC_HALT 1005
#define IDC_HALT2 1006
#define IDC_INIT 1006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 32772
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,322 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "atlres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
3 TEXTINCLUDE
BEGIN
"\r\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDR_MAINFRAME DIALOGEX 0, 0, 186, 94
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDR_MAINFRAME, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 87
END
END
#endif // APSTUDIO_INVOKED
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""atlres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DISASMDLG DIALOGEX 0, 0, 513, 298
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Debugger"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
DEFPUSHBUTTON "Step",ID_STEP,456,7,50,14
CONTROL "",IDC_DISASM_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SORTDESCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,445,284
PUSHBUTTON "&Show Regs",ID_SHOW_REGISTER,456,277,50,14
DEFPUSHBUTTON "Go",ID_GO,456,23,50,14
CONTROL "AssertInt",IDC_ASSERT_INT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,455,50,51,9
CONTROL "Halt",IDC_HALT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,455,63,51,9
CONTROL "Init",IDC_INIT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,455,75,51,9
END
IDD_REGISTERDLG DIALOGEX 0, 0, 312, 170
STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU
CAPTION "Registers Dialog"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
CONTROL "",IDC_DISASM_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTDESCENDING | LVS_ALIGNLEFT | LVS_NOSCROLL | WS_BORDER | WS_TABSTOP,7,7,298,156
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DISASMDLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 506
TOPMARGIN, 7
BOTTOMMARGIN, 291
END
IDD_REGISTERDLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 305
TOPMARGIN, 7
BOTTOMMARGIN, 163
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
"P", ID_FILE_PRINT, VIRTKEY, CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
END
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "FileDescription", "test1 Module"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "TEST1"
VALUE "LegalCopyright", "Copyright 2004"
VALUE "OriginalFilename", "demoproject1.exe"
VALUE "ProductName", "demoproject1 Module"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDR_MAINFRAME "demoproject1"
END
STRINGTABLE
BEGIN
ID_FILE_NEW "Create a new document\nNew"
ID_FILE_OPEN "Open an existing document\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the active document\nSave"
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
ID_FILE_PRINT "Print the active document\nPrint"
ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
END
STRINGTABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
END
STRINGTABLE
BEGIN
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
END
STRINGTABLE
BEGIN
ID_WINDOW_NEW "Open another window for the active document\nNew Window"
ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE
BEGIN
ID_EDIT_CLEAR "Erase the selection\nErase"
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
ID_EDIT_FIND "Find the specified text\nFind"
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
ID_EDIT_UNDO "Undo the last action\nUndo"
ID_EDIT_REDO "Redo the previously undone action\nRedo"
END
STRINGTABLE
BEGIN
ATL_IDS_SCSIZE "Change the window size"
ATL_IDS_SCMOVE "Change the window position"
ATL_IDS_SCMINIMIZE "Reduce the window to an icon"
ATL_IDS_SCMAXIMIZE "Enlarge the window to full size"
ATL_IDS_SCNEXTWINDOW "Switch to the next document window"
ATL_IDS_SCPREVWINDOW "Switch to the previous document window"
ATL_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE
BEGIN
ATL_IDS_SCRESTORE "Restore the window to normal size"
ATL_IDS_SCTASKLIST "Activate Task List"
ATL_IDS_MDICHILD "Activate this window"
END
STRINGTABLE
BEGIN
ATL_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE
BEGIN
ATL_IDS_MRU_FILE "Open this document"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,280 @@
// 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 <mmsystem.h>
#include <dsound.h>
#include "dsoundstream.h"
namespace DSound
{
#define BUFSIZE 32768
#define MAXWAIT 70 //ms
//THE ROCK SOLID SYNCED DSOUND ENGINE :)
//v<>ran kritiska sektion och v<>r syncevent-handle
CRITICAL_SECTION soundCriticalSection;
HANDLE soundSyncEvent;
HANDLE hThread;
StreamCallback callback;
//lite mojs
IDirectSound8* ds;
IDirectSoundBuffer* dsBuffer;
//tja.. beh<65>vs
int bufferSize; //i bytes
int totalRenderedBytes;
int sampleRate;
//med den h<>r synkar vi st<73>ngning..
//0=vi spelar ov<6F>sen, 1=st<73>ng tr<74>den NU! 2=japp,tr<74>den <20>r st<73>ngd s<> forts<74>tt
volatile int threadData;
//ser till s<> X kan delas med 32
inline int FIX32(int x)
{
return(x & (~127));
}
int DSound_GetSampleRate()
{
return(sampleRate);
}
//Dags att skapa v<>r directsound buffert
bool createBuffer()
{
PCMWAVEFORMAT pcmwf;
DSBUFFERDESC dsbdesc;
//ljudformatet
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
memset(&dsbdesc, 0, sizeof(DSBUFFERDESC));
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
pcmwf.wf.nChannels = 2;
pcmwf.wf.nSamplesPerSec = sampleRate;
pcmwf.wf.nBlockAlign = 4;
pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
pcmwf.wBitsPerSample = 16;
//buffer description
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STICKYFOCUS; //VIKTIGT //DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
dsbdesc.dwBufferBytes = bufferSize = BUFSIZE; //FIX32(pcmwf.wf.nAvgBytesPerSec); //<2F>ndra f<>r att st<73>lla in bufferstorlek
dsbdesc.lpwfxFormat = (WAVEFORMATEX*)&pcmwf;
// nu skapar vi bufferj<72>veln
if (SUCCEEDED(ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL)))
{
dsBuffer->SetCurrentPosition(0);
return(true);
}
else
{
// Failed.
dsBuffer = NULL;
return(false);
}
}
bool writeDataToBuffer(DWORD dwOffset, // Our own write cursor.
char* soundData, // Start of our data.
DWORD dwSoundBytes) // Size of block to copy.
{
void* ptr1, * ptr2;
DWORD numBytes1, numBytes2;
// Obtain memory address of write block. This will be in two parts if the block wraps around.
HRESULT hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
// If the buffer was lost, restore and retry lock.
if (DSERR_BUFFERLOST == hr)
{
dsBuffer->Restore();
hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
}
if (SUCCEEDED(hr))
{
memcpy(ptr1, soundData, numBytes1);
if (ptr2 != 0)
{
memcpy(ptr2, soundData + numBytes1, numBytes2);
}
// Release the data back to DirectSound.
dsBuffer->Unlock(ptr1, numBytes1, ptr2, numBytes2);
return(true);
} /*
else
{
char temp[8];
sprintf(temp,"%i\n",hr);
OutputDebugString(temp);
}*/
return(false);
}
inline int ModBufferSize(int x)
{
return((x + bufferSize) % bufferSize);
}
int currentPos;
int lastPos;
short realtimeBuffer[1024 * 1024];
DWORD WINAPI soundThread(void*)
{
currentPos = 0;
lastPos = 0;
//writeDataToBuffer(0,realtimeBuffer,bufferSize);
// dsBuffer->Lock(0, bufferSize, (void **)&p1, &num1, (void **)&p2, &num2, 0);
dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
while (!threadData)
{
EnterCriticalSection(&soundCriticalSection);
dsBuffer->GetCurrentPosition((DWORD*)&currentPos, 0);
int numBytesToRender = FIX32(ModBufferSize(currentPos - lastPos));
//renderStuff(numBytesToRender/2);
//if (numBytesToRender>bufferSize/2) numBytesToRender=0;
if (numBytesToRender >= 256)
{
(*callback)(realtimeBuffer, numBytesToRender >> 2, 16, 44100, 2);
writeDataToBuffer(lastPos, (char*)realtimeBuffer, numBytesToRender);
currentPos = ModBufferSize(lastPos + numBytesToRender);
totalRenderedBytes += numBytesToRender;
lastPos = currentPos;
}
LeaveCriticalSection(&soundCriticalSection);
WaitForSingleObject(soundSyncEvent, MAXWAIT);
}
dsBuffer->Stop();
threadData = 2;
return(0); //hurra!
}
bool DSound_StartSound(HWND window, int _sampleRate, StreamCallback _callback)
{
callback = _callback;
threadData = 0;
sampleRate = _sampleRate;
//no security attributes, automatic resetting, init state nonset, untitled
soundSyncEvent = CreateEvent(0, false, false, 0);
//vi initierar den...........
InitializeCriticalSection(&soundCriticalSection);
//vi vill ha access till DSOUND s<>...
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
{
return(false);
}
//samarbetsvillig? n<><6E> :)
ds->SetCooperativeLevel(window, DSSCL_NORMAL); //DSSCL_PRIORITY?
//s<>.. skapa buffern
if (!createBuffer())
{
return(false);
}
//rensa den.. ?
DWORD num1;
short* p1;
dsBuffer->Lock(0, bufferSize, (void* *)&p1, &num1, 0, 0, 0);
memset(p1, 0, num1);
dsBuffer->Unlock(p1, num1, 0, 0);
totalRenderedBytes = -bufferSize;
DWORD h;
hThread = CreateThread(0, 0, soundThread, 0, 0, &h);
SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL);
return(true);
}
void DSound_UpdateSound()
{
SetEvent(soundSyncEvent);
}
void DSound_StopSound()
{
EnterCriticalSection(&soundCriticalSection);
threadData = 1;
//kick the thread if it's waiting
SetEvent(soundSyncEvent);
LeaveCriticalSection(&soundCriticalSection);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
dsBuffer->Release();
ds->Release();
CloseHandle(soundSyncEvent);
}
int DSound_GetCurSample()
{
EnterCriticalSection(&soundCriticalSection);
int playCursor;
dsBuffer->GetCurrentPosition((DWORD*)&playCursor, 0);
playCursor = ModBufferSize(playCursor - lastPos) + totalRenderedBytes;
LeaveCriticalSection(&soundCriticalSection);
return(playCursor);
}
float DSound_GetTimer()
{
return((float)DSound_GetCurSample() * (1.0f / (4.0f * 44100.0f)));
}
}

View File

@ -0,0 +1,35 @@
// 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 __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__

View File

@ -0,0 +1,637 @@
// 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("Menmomic"), 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();
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()
{
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();
}

View File

@ -0,0 +1,150 @@
// 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:
CDisAsmDlg();
enum { IDD = IDD_DISASMDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnIdle();
BEGIN_UPDATE_UI_MAP(CDisAsmDlg)
END_UPDATE_UI_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)
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;
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);
};

View File

@ -0,0 +1,64 @@
// 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

@ -0,0 +1,59 @@
// 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 <stdio.h>
#include <stdarg.h>
#include "Globals.h"
void DebugLog(const char* _fmt, ...)
{
#ifdef _DEBUG
/* char Msg[512];
va_list ap;
va_start( ap, _fmt );
vsprintf( Msg, _fmt, ap );
va_end( ap );
OutputDebugString(Msg);
g_dspInitialize.pLog(Msg);
*/
#endif
}
void ErrorLog(const char* _fmt, ...)
{
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg);
#ifdef _WIN32
::MessageBox(NULL, Msg, "Error", MB_OK);
#endif
DSP_DebugBreak();
}

View File

@ -0,0 +1,60 @@
// 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 _GLOBALS_H
#define _GLOBALS_H
#include "pluginspecs_dsp.h"
#define WITH_DSP_ON_THREAD 1
#define DUMP_DSP_IMEM 0
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void ErrorLog(const char* _fmt, ...);
void DSP_DebugBreak();
#ifdef _DEBUG
#define _dbg_assert_(_a_) if (!(_a_)){DebugBreak();}
#define _dbg_assert_msg_(_a_, _desc_, ...)\
if (!(_a_)){\
if (MessageBox(NULL, _desc_, "*** Fatal Error ***", MB_YESNO | MB_ICONERROR) == IDNO){DebugBreak();}}
#else
#define _dbg_assert_(_a_);
#define _dbg_assert_msg_(_a_, _desc_, ...);
#endif
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef unsigned int uint;
typedef signed char sint8;
typedef signed short sint16;
typedef signed int sint32;
typedef signed long long sint64;
typedef const uint32 cuint32;
#endif

View File

@ -0,0 +1,272 @@
// 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;
}
}
bool CReBarSettings::Load(LPCTSTR szRegKey, LPCTSTR szPrefix, HKEY hkRootKey /* = HKEY_CURRENT_USER*/)
{
if (m_pBands != NULL)
{
delete[] m_pBands;
}
m_pBands = NULL;
m_cbBandCount = 0;
CRegKey reg;
DWORD err = reg.Open(hkRootKey, szRegKey, KEY_READ);
if (err == ERROR_SUCCESS)
{
reg.QueryValue(m_cbBandCount, CString(szPrefix) + S_BAR_BANDCOUNT);
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.QueryValue(m_pBands[i].ID, s + S_BAR_ID_VAL);
reg.QueryValue(m_pBands[i].cx, s + S_BAR_CX_VAL);
DWORD dw;
reg.QueryValue(dw, s + S_BAR_BREAKLINE_VAL);
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.SetValue(m_cbBandCount, CString(szPrefix) + S_BAR_BANDCOUNT);
for (DWORD i = 0; i < m_cbBandCount; i++)
{
CString s;
s.Format(_T("%s%i_"), szPrefix, i);
reg.SetValue(m_pBands[i].ID, s + S_BAR_ID_VAL);
reg.SetValue(m_pBands[i].cx, s + S_BAR_CX_VAL);
DWORD dw = m_pBands[i].BreakLine;
reg.SetValue(dw, s + S_BAR_BREAKLINE_VAL);
}
}
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.QueryValue(m_dwPos, CString(szPrefix) + S_SPLITTER_POS);
}
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.SetValue(m_dwPos, CString(szPrefix) + S_SPLITTER_POS);
}
return(err == ERROR_SUCCESS);
}

View File

@ -0,0 +1,81 @@
// 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

@ -0,0 +1,207 @@
// 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

@ -0,0 +1,80 @@
// 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

@ -0,0 +1,17 @@
Import('env')
output = "../../../../Binary/linux/Plugins/temp/dsplle.so"
files = ["disassemble.cpp",
"gdsp_aram.cpp",
"gdsp_ext_op.cpp",
"gdsp_interface.cpp",
"gdsp_interpreter.cpp",
"gdsp_memory.cpp",
"gdsp_opcodes.cpp",
"gdsp_registers.cpp",
"Globals.cpp",
"opcodes.cpp",
"Tools.cpp",
"UCode_AX.cpp",
]
#env.Append(LINKFLAGS = "-symbolic")
env.SharedLibrary(output, files)

View File

@ -0,0 +1,87 @@
// 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 <stdio.h>
#include <stdlib.h>
#include "Common.h"
#include "Globals.h"
#include "gdsp_interpreter.h"
bool DumpDSPCode(uint32 _Address, uint32 _Length)
{
FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb");
if (pFile != NULL)
{
fwrite(g_dspInitialize.pGetMemoryPointer(_Address), _Length, 1, pFile);
fclose(pFile);
return(true);
}
return(false);
}
uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
{
unsigned long CRC = 0xFFFFFFFF;
while (_pLength--)
{
unsigned long Temp = (unsigned long)((CRC & 0xFF) ^ *_pBuffer++);
for (int j = 0; j < 8; j++)
{
if (Temp & 0x1)
{
Temp = (Temp >> 1) ^ 0xEDB88320;
}
else
{
Temp >>= 1;
}
}
CRC = (CRC >> 8) ^ Temp;
}
return(CRC ^ 0xFFFFFFFF);
}
bool DumpCWCode(uint32 _Address, uint32 _Length)
{
FILE* pFile = fopen("d:\\DSP_UCode.bin", "wb");
if (pFile != NULL)
{
for (size_t i = _Address; i < _Address + _Length; i++)
{
uint16 val = Common::swap16(g_dsp.iram[i]);
fprintf(pFile, " cw 0x%04x \n", val);
}
fclose(pFile);
return(true);
}
return(false);
}

View File

@ -0,0 +1,50 @@
// 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
// UDSPControl
union UDSPControl
{
uint16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned unk3 : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(uint16 _Hex = 0)
: Hex(_Hex) {}
};
bool DumpDSPCode(uint32 _Address, uint32 _Length);
uint32 GenerateCRC(const unsigned char* _pBuffer, int _pLength);
bool DumpCWCode(uint32 _Address, uint32 _Length);

View File

@ -0,0 +1,619 @@
/*====================================================================
filename: disassemble.cpp
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include "Globals.h"
#include "disassemble.h"
#include "opcodes.h"
// #include "gdsp_tool.h"
#ifdef _MSC_VER
#pragma warning(disable:4996)
#endif
uint32 unk_opcodes[0x10000];
uint16 swap16(uint16 x);
// predefined labels
typedef struct pdlabel_t
{
uint16 addr;
const char* name;
const char* description;
} pdlabels_t;
const pdlabel_t pdlabels[] =
{
{0xffa0, "COEF_A1_0", "COEF_A1_0",},
{0xffa1, "COEF_A2_0", "COEF_A2_0",},
{0xffa2, "COEF_A1_1", "COEF_A1_1",},
{0xffa3, "COEF_A2_1", "COEF_A2_1",},
{0xffa4, "COEF_A1_2", "COEF_A1_2",},
{0xffa5, "COEF_A2_2", "COEF_A2_2",},
{0xffa6, "COEF_A1_3", "COEF_A1_3",},
{0xffa7, "COEF_A2_3", "COEF_A2_3",},
{0xffa8, "COEF_A1_4", "COEF_A1_4",},
{0xffa9, "COEF_A2_4", "COEF_A2_4",},
{0xffaa, "COEF_A1_5", "COEF_A1_5",},
{0xffab, "COEF_A2_5", "COEF_A2_5",},
{0xffac, "COEF_A1_6", "COEF_A1_6",},
{0xffad, "COEF_A2_6", "COEF_A2_6",},
{0xffae, "COEF_A1_7", "COEF_A1_7",},
{0xffaf, "COEF_A2_7", "COEF_A2_7",},
{0xffc9, "DSCR", "DSP DMA Control Reg",},
{0xffcb, "DSBL", "DSP DMA Block Length",},
{0xffcd, "DSPA", "DSP DMA DMEM Address",},
{0xffce, "DSMAH", "DSP DMA Mem Address H",},
{0xffcf, "DSMAL", "DSP DMA Mem Address L",},
{0xffd1, "SampleFormat", "SampleFormat",},
{0xffd4, "ACSAH", "Accelerator start address H",},
{0xffd5, "ACSAL", "Accelerator start address L",},
{0xffd6, "ACEAH", "Accelerator end address H",},
{0xffd7, "ACEAL", "Accelerator end address L",},
{0xffd8, "ACCAH", "Accelerator current address H",},
{0xffd9, "ACCAL", "Accelerator current address L",},
{0xffda, "pred_scale", "pred_scale",},
{0xffdb, "yn1", "yn1",},
{0xffdc, "yn2", "yn2",},
{0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",},
{0xffde, "GAIN", "Gain",},
{0xffef, "AMDM", "ARAM DMA Request Mask",},
{0xfffb, "DIRQ", "DSP IRQ Request",},
{0xfffc, "DMBH", "DSP Mailbox H",},
{0xfffd, "DMBL", "DSP Mailbox L",},
{0xfffe, "CMBH", "CPU Mailbox H",},
{0xffff, "CMBL", "CPU Mailbox L",},
};
pdlabel_t regnames[] =
{
{0x00, "R00", "Register 00",},
{0x01, "R01", "Register 01",},
{0x02, "R02", "Register 02",},
{0x03, "R03", "Register 03",},
{0x04, "R04", "Register 04",},
{0x05, "R05", "Register 05",},
{0x06, "R06", "Register 06",},
{0x07, "R07", "Register 07",},
{0x08, "R08", "Register 08",},
{0x09, "R09", "Register 09",},
{0x0a, "R10", "Register 10",},
{0x0b, "R11", "Register 11",},
{0x0c, "ST0", "Call stack",},
{0x0d, "ST1", "Data stack",},
{0x0e, "ST2", "Loop address stack",},
{0x0f, "ST3", "Loop counter",},
{0x00, "ACH0", "Accumulator High 0",},
{0x11, "ACH1", "Accumulator High 1",},
{0x12, "CR", "Config Register",},
{0x13, "SR", "Special Register",},
{0x14, "PROD.L", "PROD L",},
{0x15, "PROD.M1", "PROD M1",},
{0x16, "PROD.H", "PROD H",},
{0x17, "PROD.M2", "PROD M2",},
{0x18, "AX0.L", "Additional Accumulators Low 0",},
{0x19, "AX1.L", "Additional Accumulators Low 1",},
{0x1a, "AX0.H", "Additional Accumulators High 0",},
{0x1b, "AX1.H", "Additional Accumulators High 1",},
{0x1c, "AC0.L", "Register 28",},
{0x1d, "AC1.L", "Register 29",},
{0x1e, "AC0.M", "Register 00",},
{0x1f, "AC1.M", "Register 00",},
// additional to resolve special names
{0x20, "ACC0", "Accumulators 0",},
{0x21, "ACC1", "Accumulators 1",},
{0x22, "AX0", "Additional Accumulators 0",},
{0x23, "AX1", "Additional Accumulators 1",},
};
const char* pdname(uint16 val)
{
static char tmpstr[12]; // nasty
for (int i = 0; i < (int)(sizeof(pdlabels) / sizeof(pdlabel_t)); i++)
{
if (pdlabels[i].addr == val)
{
return(pdlabels[i].name);
}
}
sprintf(tmpstr, "0x%04x", val);
return(tmpstr);
}
char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, uint16 op1, uint16 op2, char* strbuf)
{
char* buf = strbuf;
uint32 val;
int j;
for (j = 0; j < opc->param_count; j++)
{
if (j > 0)
{
sprintf(buf, ", ");
buf += strlen(buf);
}
if (opc->params[j].loc >= 1)
{
val = op2;
}
else
{
val = op1;
}
val &= opc->params[j].mask;
if (opc->params[j].lshift < 0)
{
val = val << (-opc->params[j].lshift);
}
else
{
val = val >> opc->params[j].lshift;
}
uint32 type;
type = opc->params[j].type;
if (type & P_REG)
{
if (type == P_ACCM_D)
{
val = (~val & 0x1) | ((type & P_REGS_MASK) >> 8);
}
else
{
val |= (type & P_REGS_MASK) >> 8;
}
type &= ~P_REGS_MASK;
}
switch (type)
{
case P_REG:
if (gdg->decode_registers){sprintf(buf, "$%s", regnames[val].name);}
else {sprintf(buf, "$%d", val);}
break;
case P_PRG:
if (gdg->decode_registers){sprintf(buf, "@$%s", regnames[val].name);}
else {sprintf(buf, "@$%d", val);}
break;
case P_VAL:
sprintf(buf, "0x%04x", val);
break;
case P_IMM:
if (opc->params[j].size != 2)
{
sprintf(buf, "#0x%02x", val);
}
else
{
sprintf(buf, "#0x%04x", val);
}
break;
case P_MEM:
if (opc->params[j].size != 2)
{
val = (uint16)(sint8)val;
}
if (gdg->decode_names)
{
sprintf(buf, "@%s", pdname(val));
}
else
{
sprintf(buf, "@0x%04x", val);
}
break;
default:
ErrorLog("Unknown parameter type: %x\n", opc->params[j].type);
exit(-1);
break;
}
buf += strlen(buf);
}
return(strbuf);
}
gd_globals_t* gd_init()
{
gd_globals_t* gdg = (gd_globals_t*)malloc(sizeof(gd_globals_t));
memset(gdg, 0, sizeof(gd_globals_t));
return(gdg);
}
uint16 gd_dis_get_opcode_size(gd_globals_t* gdg)
{
opc_t* opc = 0;
opc_t* opc_ext = 0;
bool extended;
if ((gdg->pc & 0x7fff) >= 0x1000)
{
return(1);
}
uint32 op1 = swap16(gdg->binbuf[gdg->pc & 0x0fff]);
for (uint32 j = 0; j < opcodes_size; j++)
{
uint16 mask;
if (opcodes[j].size & P_EXT)
{
mask = opcodes[j].opcode_mask & 0xff00;
}
else
{
mask = opcodes[j].opcode_mask;
}
if ((op1 & mask) == opcodes[j].opcode)
{
opc = &opcodes[j];
break;
}
}
if (!opc)
{
ErrorLog("get_opcode_size ARGH");
exit(0);
}
if (opc->size & P_EXT && op1 & 0x00ff)
{
extended = true;
}
else
{
extended = false;
}
if (extended)
{
// opcode has an extension
// find opcode
for (uint32 j = 0; j < opcodes_ext_size; j++)
{
if ((op1 & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode)
{
opc_ext = &opcodes_ext[j];
break;
}
}
if (!opc_ext)
{
ErrorLog("get_opcode_size ext ARGH");
}
return(opc_ext->size);
}
return(opc->size & ~P_EXT);
}
char* gd_dis_opcode(gd_globals_t* gdg)
{
uint32 j;
uint32 op1, op2;
opc_t* opc;
opc_t* opc_ext;
uint16 pc;
char* buf = gdg->buffer;
bool extended;
pc = gdg->pc;
*buf = '\0';
if ((pc & 0x7fff) >= 0x1000)
{
gdg->pc++;
return(gdg->buffer);
}
pc &= 0x0fff;
op1 = swap16(gdg->binbuf[pc]);
// find opcode
for (j = 0; j < opcodes_size; j++)
{
uint16 mask;
if (opcodes[j].size & P_EXT)
{
mask = opcodes[j].opcode_mask & 0xff00;
}
else
{
mask = opcodes[j].opcode_mask;
}
if ((op1 & mask) == opcodes[j].opcode)
{
opc = &opcodes[j];
break;
}
}
if (opc->size & P_EXT && op1 & 0x00ff)
{
extended = true;
}
else
{
extended = false;
}
if (extended)
{
// opcode has an extension
// find opcode
for (j = 0; j < opcodes_ext_size; j++)
{
if ((op1 & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode)
{
opc_ext = &opcodes_ext[j];
break;
}
}
}
// printing
if (gdg->show_pc){sprintf(buf, "%04x ", gdg->pc);}
buf += strlen(buf);
if ((opc->size & ~P_EXT) == 2)
{
op2 = swap16(gdg->binbuf[pc + 1]);
if (gdg->show_hex){sprintf(buf, "%04x %04x ", op1, op2);}
}
else
{
op2 = 0;
if (gdg->show_hex){sprintf(buf, "%04x ", op1);}
}
buf += strlen(buf);
char tmpbuf[20];
if (extended)
{
sprintf(tmpbuf, "%s%c%s", opc->name, gdg->ext_separator, opc_ext->name);
}
else
{
sprintf(tmpbuf, "%s", opc->name);
}
if (gdg->print_tabs)
{
sprintf(buf, "%s\t", tmpbuf);
}
else
{
sprintf(buf, "%-12s", tmpbuf);
}
buf += strlen(buf);
if (opc->param_count > 0)
{
gd_dis_params(gdg, opc, op1, op2, buf);
}
buf += strlen(buf);
if (extended)
{
if (opc->param_count > 0)
{
sprintf(buf, " ");
}
buf += strlen(buf);
sprintf(buf, ": ");
buf += strlen(buf);
if (opc_ext->param_count > 0)
{
gd_dis_params(gdg, opc_ext, op1, op2, buf);
}
buf += strlen(buf);
}
if (opc->opcode_mask == 0)
{
// unknown opcode
unk_opcodes[op1]++;
sprintf(buf, "\t\t; *** UNKNOWN OPCODE ***");
}
if (extended)
{
gdg->pc += opc_ext->size;
}
else
{
gdg->pc += opc->size & ~P_EXT;
}
return(gdg->buffer);
}
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output)
{
FILE* in;
uint32 size;
in = fopen(name, "rb");
if (in == NULL)
{
return(false);
}
fseek(in, 0, SEEK_END);
size = ftell(in);
fseek(in, 0, SEEK_SET);
gdg->binbuf = (uint16*)malloc(size);
fread(gdg->binbuf, 1, size, in);
gdg->buffer = (char*)malloc(256);
gdg->buffer_size = 256;
for (gdg->pc = 0; gdg->pc < (size / 2);)
{
fprintf(output, "%s\n", gd_dis_opcode(gdg));
}
fclose(in);
free(gdg->binbuf);
gdg->binbuf = NULL;
free(gdg->buffer);
gdg->buffer = NULL;
gdg->buffer_size = 0;
return(true);
}
void gd_dis_close_unkop()
{
FILE* uo;
int i, j;
uint32 count = 0;
uo = fopen("uo.bin", "wb");
if (uo)
{
fwrite(unk_opcodes, 1, sizeof(unk_opcodes), uo);
fclose(uo);
}
uo = fopen("unkopc.txt", "w");
if (uo)
{
for (i = 0; i < 0x10000; i++)
{
if (unk_opcodes[i])
{
count++;
fprintf(uo, "OP%04x\t%d", i, unk_opcodes[i]);
for (j = 15; j >= 0; j--)
{
if ((j & 0x3) == 3)
{
fprintf(uo, "\tb");
}
fprintf(uo, "%d", (i >> j) & 0x1);
}
fprintf(uo, "\n");
}
}
fprintf(uo, "Unknown opcodes count: %d\n", count);
fclose(uo);
}
}
void gd_dis_open_unkop()
{
FILE* uo;
uo = fopen("uo.bin", "rb");
if (uo)
{
fread(unk_opcodes, 1, sizeof(unk_opcodes), uo);
fclose(uo);
}
else
{
int i;
for (i = 0; i < 0x10000; i++)
{
unk_opcodes[i] = 0;
}
}
}
const char* gd_dis_get_reg_name(uint16 reg)
{
return(regnames[reg].name);
}

View File

@ -0,0 +1,46 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#pragma once
typedef struct gd_globals_t
{
bool print_tabs;
bool show_hex;
bool show_pc;
bool decode_names;
bool decode_registers;
uint16* binbuf;
uint16 pc;
char* buffer;
uint16 buffer_size;
char ext_separator;
} gd_globals_t;
char* gd_dis_opcode(gd_globals_t* gdg);
bool gd_dis_file(gd_globals_t* gdg, char* name, FILE* output);
const char* gd_dis_get_reg_name(uint16 reg);

View File

@ -0,0 +1,114 @@
// 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 "gdsp_interface.h"
extern uint16 dsp_swap16(uint16 x);
// the hardware adpcm decoder :)
sint16 ADPCM_Step(uint32& _rSamplePos, uint32 _BaseAddress)
{
sint16* pCoefTable = (sint16*)&gdsp_ifx_regs[DSP_COEF_A1_0];
if (((_rSamplePos) & 15) == 0)
{
gdsp_ifx_regs[DSP_PRED_SCALE] = g_dspInitialize.pARAM_Read_U8((_rSamplePos & ~15) >> 1);
_rSamplePos += 2;
}
int scale = 1 << (gdsp_ifx_regs[DSP_PRED_SCALE] & 0xF);
int coef_idx = gdsp_ifx_regs[DSP_PRED_SCALE] >> 4;
sint32 coef1 = pCoefTable[coef_idx * 2 + 0];
sint32 coef2 = pCoefTable[coef_idx * 2 + 1];
int temp = (_rSamplePos & 1) ?
(g_dspInitialize.pARAM_Read_U8(_rSamplePos >> 1) & 0xF) :
(g_dspInitialize.pARAM_Read_U8(_rSamplePos >> 1) >> 4);
if (temp >= 8)
{
temp -= 16; //temp += 0xFFFFFFF0;
}
//0x400 = 0.5 in 11-bit fixed point
int val = (scale * temp) + ((0x400 + coef1 * (sint16)gdsp_ifx_regs[DSP_YN1] + coef2 * (sint16)gdsp_ifx_regs[DSP_YN2]) >> 11);
if (val > 0x7FFF)
{
val = 0x7FFF;
}
else if (val < -0x7FFF)
{
val = -0x7FFF;
}
gdsp_ifx_regs[DSP_YN2] = gdsp_ifx_regs[DSP_YN1];
gdsp_ifx_regs[DSP_YN1] = val;
_rSamplePos++;
return(val);
// I think the interpolation (linear, polyphase,...) is done by the UCode
}
uint16 dsp_read_aram()
{
uint32 BaseAddress = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL];
uint32 EndAddress = (gdsp_ifx_regs[DSP_ACEAH] << 16) | gdsp_ifx_regs[DSP_ACEAL];
uint32 Address = (gdsp_ifx_regs[DSP_ACCAH] << 16) | gdsp_ifx_regs[DSP_ACCAL];
uint16 val;
// lets the "hardware" decode
switch (gdsp_ifx_regs[DSP_FORMAT])
{
case 0x00:
val = ADPCM_Step(Address, EndAddress);
break;
case 0x0A:
val = (g_dspInitialize.pARAM_Read_U8(Address) << 8) | g_dspInitialize.pARAM_Read_U8(Address + 1);
gdsp_ifx_regs[DSP_YN2] = gdsp_ifx_regs[DSP_YN1];
gdsp_ifx_regs[DSP_YN1] = val;
Address += 2;
break;
default:
val = (g_dspInitialize.pARAM_Read_U8(Address) << 8) | g_dspInitialize.pARAM_Read_U8(Address + 1);
Address += 2;
ErrorLog("Unknown DSP Format %i", gdsp_ifx_regs[DSP_FORMAT]);
break;
}
// check for loop
if (Address > EndAddress)
{
Address = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL];
//ErrorLog("Should we generate a lvl5 exception !??!");
//gdsp_exception(5);
}
gdsp_ifx_regs[DSP_ACCAH] = Address >> 16;
gdsp_ifx_regs[DSP_ACCAL] = Address & 0xffff;
return(val);
}

View File

@ -0,0 +1,19 @@
// 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
uint16 dsp_read_aram();

View File

@ -0,0 +1,288 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
//
//
// At the moment just ls and sl are using the prolog
// perhaps all actions on r03 must be in the prolog
//
#include "Globals.h"
#include "gdsp_ext_op.h"
#include "gdsp_interpreter.h"
#include "gdsp_memory.h"
extern inline void dsp_op_write_reg(uint8 reg, uint16 val);
//
void dsp_op_ext_r_epi(uint16 _Opcode)
{
uint8 op = (_Opcode >> 2) & 0x3;
uint8 reg = _Opcode & 0x3;
switch (op)
{
case 0x00:
ErrorLog("dsp_op_ext_r_epi");
break;
case 0x01:
g_dsp.r[reg]--;
break;
case 0x02:
g_dsp.r[reg]++;
break;
case 0x03:
g_dsp.r[reg] += g_dsp.r[reg + 4];
break;
}
}
void dsp_op_ext_mv(uint16 _Opcode)
{
uint8 sreg = _Opcode & 0x3;
uint8 dreg = ((_Opcode >> 2) & 0x3);
g_dsp.r[dreg + 0x18] = g_dsp.r[sreg + 0x1c];
}
void dsp_op_ext_s(uint16 _Opcode)
{
uint8 dreg = _Opcode & 0x3;
uint8 sreg = ((_Opcode >> 3) & 0x3) + 0x1c;
dsp_dmem_write(g_dsp.r[dreg], g_dsp.r[sreg]);
if (_Opcode & 0x04)
{
g_dsp.r[dreg] += g_dsp.r[dreg + 4];
}
else
{
g_dsp.r[dreg]++;
}
}
void dsp_op_ext_l(uint16 _Opcode)
{
uint8 sreg = _Opcode & 0x3;
uint8 dreg = ((_Opcode >> 3) & 0x7) + 0x18;
uint16 val = dsp_dmem_read(g_dsp.r[sreg]);
g_dsp.r[dreg] = val;
if (_Opcode & 0x04)
{
g_dsp.r[sreg] += g_dsp.r[sreg + 4];
}
else
{
g_dsp.r[sreg]++;
}
}
void dsp_op_ext_ls_pro(uint16 _Opcode)
{
uint8 areg = (_Opcode & 0x1) + 0x1e;
dsp_dmem_write(g_dsp.r[0x03], g_dsp.r[areg]);
if (_Opcode & 0x8)
{
g_dsp.r[0x03] += g_dsp.r[0x07];
}
else
{
g_dsp.r[0x03]++;
}
}
void dsp_op_ext_ls_epi(uint16 _Opcode)
{
uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18;
uint16 val = dsp_dmem_read(g_dsp.r[0x00]);
dsp_op_write_reg(dreg, val);
if (_Opcode & 0x4)
{
g_dsp.r[0x00] += g_dsp.r[0x04];
}
else
{
g_dsp.r[0x00]++;
}
}
void dsp_op_ext_sl_pro(uint16 _Opcode)
{
uint8 areg = (_Opcode & 0x1) + 0x1e;
dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
if (_Opcode & 0x4)
{
g_dsp.r[0x00] += g_dsp.r[0x04];
}
else
{
g_dsp.r[0x00]++;
}
}
void dsp_op_ext_sl_epi(uint16 _Opcode)
{
uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18;
uint16 val = dsp_dmem_read(g_dsp.r[0x03]);
dsp_op_write_reg(dreg, val);
if (_Opcode & 0x8)
{
g_dsp.r[0x03] += g_dsp.r[0x07];
}
else
{
g_dsp.r[0x03]++;
}
}
void dsp_op_ext_ld(uint16 _Opcode)
{
uint8 dreg1 = (((_Opcode >> 5) & 0x1) << 1) + 0x18;
uint8 dreg2 = (((_Opcode >> 4) & 0x1) << 1) + 0x19;
uint8 sreg = _Opcode & 0x3;
g_dsp.r[dreg1] = dsp_dmem_read(g_dsp.r[sreg]);
g_dsp.r[dreg2] = dsp_dmem_read(g_dsp.r[0x03]);
if (_Opcode & 0x04)
{
g_dsp.r[sreg] += g_dsp.r[sreg + 0x04];
}
else
{
g_dsp.r[sreg]++;
}
if (_Opcode & 0x08)
{
g_dsp.r[0x03] += g_dsp.r[0x07];
}
else
{
g_dsp.r[0x03]++;
}
}
// ================================================================================
//
//
//
// ================================================================================
void dsp_op_ext_ops_pro(uint16 _Opcode)
{
if ((_Opcode & 0xFF) == 0){return;}
switch ((_Opcode >> 4) & 0xf)
{
case 0x00:
dsp_op_ext_r_epi(_Opcode);
break;
case 0x01:
dsp_op_ext_mv(_Opcode);
break;
case 0x02:
case 0x03:
dsp_op_ext_s(_Opcode);
break;
case 0x04:
case 0x05:
case 0x06:
case 0x07:
dsp_op_ext_l(_Opcode);
break;
case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
if (_Opcode & 0x2)
{
dsp_op_ext_sl_pro(_Opcode);
}
else
{
dsp_op_ext_ls_pro(_Opcode);
}
return;
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
dsp_op_ext_ld(_Opcode);
break;
}
}
void dsp_op_ext_ops_epi(uint16 _Opcode)
{
if ((_Opcode & 0xFF) == 0){return;}
switch ((_Opcode >> 4) & 0xf)
{
case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
if (_Opcode & 0x2)
{
dsp_op_ext_sl_epi(_Opcode);
}
else
{
dsp_op_ext_ls_epi(_Opcode);
}
return;
}
}

View File

@ -0,0 +1,33 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_EXT_OP_H
#define _GDSP_EXT_OP_H
void dsp_op_ext_ops_pro(uint16 _Opcode);
void dsp_op_ext_ops_epi(uint16 _Opcode);
#endif

View File

@ -0,0 +1,35 @@
/*====================================================================
filename: gdsp_ifx.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
// ADPCM hw
#ifndef _GDSP_IFX_H
#define _GDSP_IFX_H
void gdsp_ifx_write(uint16 addr, uint16 val);
uint16 gdsp_ifx_read(uint16 addr);
#endif

View File

@ -0,0 +1,350 @@
/*====================================================================
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include <stdlib.h>
#include "Globals.h"
#include "gdsp_aram.h"
#include "gdsp_interpreter.h"
#include "gdsp_interface.h"
#include "Tools.h"
#ifndef NULL
#define NULL 0
#endif
#ifndef _WIN32
#undef WITH_DSP_ON_THREAD
//TODO FIX
#endif
const char* reg_names[] =
{
// a0
"COEF_A1_0", "COEF_A2_0", "COEF_A1_1", "COEF_A2_1", "COEF_A1_2", "COEF_A2_2", "COEF_A1_3", "COEF_A2_3",
"COEF_A1_4", "COEF_A2_4", "COEF_A1_5", "COEF_A2_5", "COEF_A1_6", "COEF_A2_6", "COEF_A1_7", "COEF_A2_7",
// b0
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
// c0
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, "DSCR", NULL, "DSBL", NULL, "DSPA", "DSMAH", "DSMAL",
// d0
NULL, "SampleFormat", NULL, NULL, "ACSAH", "ACSAL", "ACEAH", "ACEAL",
"ACCAH", "ACCAL", "PRED_SCALE", "YN1", "YN2", "ARAM", "GAIN", NULL,
// e0
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, "AMDM",
// f0
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, "DMBH", "DMBL", "CMBH", "CMBL",
};
void gdsp_dma();
#ifdef _WIN32
extern CRITICAL_SECTION g_CriticalSection;
#endif
static volatile uint16 gdsp_mbox[2][2];
uint16 gdsp_ifx_regs[256];
void gdsp_ifx_init()
{
int i;
for (i = 0; i < 256; i++)
{
gdsp_ifx_regs[i] = 0;
}
gdsp_mbox[0][0] = 0;
gdsp_mbox[0][1] = 0;
gdsp_mbox[1][0] = 0;
gdsp_mbox[1][1] = 0;
}
uint32 gdsp_mbox_peek(uint8 mbx)
{
return((gdsp_mbox[mbx][0] << 16) | gdsp_mbox[mbx][1]);
}
void gdsp_mbox_write_h(uint8 mbx, uint16 val)
{
#if WITH_DSP_ON_THREAD
EnterCriticalSection(&g_CriticalSection);
#endif
gdsp_mbox[mbx][0] = val & 0x7fff;
#if WITH_DSP_ON_THREAD
LeaveCriticalSection(&g_CriticalSection);
#endif
}
void gdsp_mbox_write_l(uint8 mbx, uint16 val)
{
#if WITH_DSP_ON_THREAD
EnterCriticalSection(&g_CriticalSection);
#endif
gdsp_mbox[mbx][1] = val;
gdsp_mbox[mbx][0] |= 0x8000;
#if WITH_DSP_ON_THREAD
LeaveCriticalSection(&g_CriticalSection);
#endif
if (mbx == GDSP_MBOX_DSP)
{
DebugLog("- Write DSP Mail: 0x%08x (pc=0x%04x)\n", gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.err_pc);
}
}
uint16 gdsp_mbox_read_h(uint8 mbx)
{
return(gdsp_mbox[mbx][0]);
}
uint16 gdsp_mbox_read_l(uint8 mbx)
{
uint16 val;
#if WITH_DSP_ON_THREAD
EnterCriticalSection(&g_CriticalSection);
#endif
val = gdsp_mbox[mbx][1];
gdsp_mbox[mbx][0] &= ~0x8000;
#if WITH_DSP_ON_THREAD
LeaveCriticalSection(&g_CriticalSection);
#endif
return(val);
}
void gdsp_ifx_write(uint16 addr, uint16 val)
{
addr &= 0xff;
switch (addr & 0xff)
{
case 0xfb: // DIRQ
if (val & 0x1)
{
g_dsp.irq_request();
}
break;
case 0xfc: // DMBH
gdsp_mbox_write_h(GDSP_MBOX_DSP, val);
break;
case 0xfd: // DMBL
gdsp_mbox_write_l(GDSP_MBOX_DSP, val);
break;
case 0xcb: // DSBL
gdsp_ifx_regs[addr] = val;
gdsp_dma();
gdsp_ifx_regs[DSP_DSCR] &= ~0x0004;
break;
case 0xcd:
case 0xce:
case 0xcf:
case 0xc9:
gdsp_ifx_regs[addr] = val;
break;
default:
/* if ((addr & 0xff) >= 0xa0 && reg_names[addr - 0xa0])
DebugLog("%04x MW %s (%04x)\n", g_dsp.pc, reg_names[addr - 0xa0], val);
else
DebugLog("%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);*/
gdsp_ifx_regs[addr] = val;
break;
}
}
uint16 gdsp_ifx_read(uint16 addr)
{
uint16 val;
addr &= 0xff;
switch (addr & 0xff)
{
case 0xfc: // DMBH
val = gdsp_mbox_read_h(GDSP_MBOX_DSP);
break;
case 0xfe: // CMBH
val = gdsp_mbox_read_h(GDSP_MBOX_CPU);
break;
case 0xff: // CMBL
val = gdsp_mbox_read_l(GDSP_MBOX_CPU);
break;
case 0xc9:
val = gdsp_ifx_regs[addr];
break;
case 0xdd:
val = dsp_read_aram();
break;
default:
val = gdsp_ifx_regs[addr];
/* if ((addr & 0xff) >= 0xc0 && reg_names[addr & 0x3f])
printf("%04x MR %s (%04x)\n", g_dsp.pc, reg_names[addr & 0x3f], val);
else
printf("%04x MR %04x (%04x)\n", g_dsp.pc, addr, val);*/
break;
}
return(val);
}
void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size)
{
#if DUMP_DSP_IMEM
DumpDSPCode(addr, size);
#endif
uint8* dst = ((uint8*)g_dsp.iram);
for (uint32 i = 0; i < size; i += 2)
{
*(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff];
}
g_dsp.iram_crc = GenerateCRC(g_dsp.cpu_ram + (addr & 0x0fffffff), size);
DebugLog("*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc);
}
void gdsp_idma_out(uint16 dsp_addr, uint32 addr, uint32 size)
{
ErrorLog("*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size);
}
void gdsp_ddma_in(uint16 dsp_addr, uint32 addr, uint32 size)
{
if ((addr & 0x7FFFFFFF) > 0x01FFFFFF)
{
ErrorLog("*** ddma_in read from invalid addr (0x%08x)\n", addr);
return;
}
uint8* dst = ((uint8*)g_dsp.dram);
for (uint32 i = 0; i < size; i += 2)
{
*(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF];
}
DebugLog("*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)\n", addr, dsp_addr / 2, size);
}
void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size)
{
if ((addr & 0x7FFFFFFF) > 0x01FFFFFF)
{
ErrorLog("*** gdsp_ddma_out to invalid addr (0x%08x)\n", addr);
return;
}
uint8* src = ((uint8*)g_dsp.dram);
for (uint32 i = 0; i < size; i += 2)
{
*(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF] = *(uint16*)&src[dsp_addr + i];
}
DebugLog("*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size);
}
#define DSP_CR_IMEM (2)
#define DSP_CR_DMEM (0)
#define DSP_CR_TO_CPU (1)
#define DSP_CR_FROM_CPU (0)
void gdsp_dma()
{
uint16 ctl;
uint32 addr;
uint16 dsp_addr;
uint16 len;
addr = (gdsp_ifx_regs[DSP_DSMAH] << 16) | gdsp_ifx_regs[DSP_DSMAL];
ctl = gdsp_ifx_regs[DSP_DSCR];
dsp_addr = gdsp_ifx_regs[DSP_DSPA] * 2;
len = gdsp_ifx_regs[DSP_DSBL];
if ((ctl > 3) || (len > 0x4000))
{
ErrorLog("DMA ERROR pc: %04x ctl: %04x addr: %08x da: %04x size: %04x\n", g_dsp.pc, ctl, addr, dsp_addr, len);
exit(0);
}
switch (ctl & 0x3)
{
case (DSP_CR_DMEM | DSP_CR_TO_CPU):
gdsp_ddma_out(dsp_addr, addr, len);
break;
case (DSP_CR_DMEM | DSP_CR_FROM_CPU):
gdsp_ddma_in(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_TO_CPU):
gdsp_idma_out(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_FROM_CPU):
gdsp_idma_in(dsp_addr, addr, len);
break;
}
}

View File

@ -0,0 +1,67 @@
/*====================================================================
filename: gdsp_interface.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERFACE_H
#define _GDSP_INTERFACE_H
#include "Globals.h"
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
#define DSP_DSMAH 0xce
#define DSP_DSMAL 0xcf
#define DSP_DSCR 0xc9
#define DSP_DSPA 0xcd
#define DSP_DSBL 0xcb
#define DSP_ACSAH 0xd4
#define DSP_ACSAL 0xd5
#define DSP_ACEAH 0xd6
#define DSP_ACEAL 0xd7
#define DSP_ACCAH 0xd8
#define DSP_ACCAL 0xd9
#define DSP_COEF_A1_0 0xa0
#define DSP_FORMAT 0xd1
#define DSP_PRED_SCALE 0xda
#define DSP_YN1 0xdb
#define DSP_YN2 0xdc
#define DSP_ARAM 0xdd
#define DSP_GAIN 0xde
extern uint16 gdsp_ifx_regs[256];
uint32 gdsp_mbox_peek(uint8 mbx);
void gdsp_mbox_write_h(uint8 mbx, uint16 val);
void gdsp_mbox_write_l(uint8 mbx, uint16 val);
uint16 gdsp_mbox_read_h(uint8 mbx);
uint16 gdsp_mbox_read_l(uint8 mbx);
void gdsp_ifx_init();
void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size);
#endif

View File

@ -0,0 +1,344 @@
/*====================================================================
filename: gdsp_interpreter.cpp
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include <stdio.h>
#include <stdlib.h>
#include "gdsp_opcodes.h"
#include "gdsp_interpreter.h"
#include "gdsp_memory.h"
#include "gdsp_registers.h"
#include "gdsp_interface.h"
#include "Tools.h"
//-------------------------------------------------------------------------------
SDSP g_dsp;
uint16 SDSP::r[32];
uint16 SDSP::pc = 0;
uint16 SDSP::err_pc = 0;
uint16* SDSP::iram = 0;
uint16* SDSP::dram = 0;
uint16* SDSP::irom = 0;
uint16* SDSP::drom = 0;
uint16* SDSP::coef = 0;
uint8* SDSP::cpu_ram = 0;
uint16 SDSP::cr = 0;
uint8 SDSP::reg_stack_ptr[4];
// lets make stack depth to 32 for now
uint16 SDSP::reg_stack[4][DSP_STACK_DEPTH];
void (*SDSP::irq_request)() = NULL;
bool SDSP::exception_in_progress_hack = false;
// for debugger only
uint32 SDSP::iram_crc = 0;
uint64 SDSP::step_counter = 0;
//-------------------------------------------------------------------------------
static bool CR_HALT = true;
static bool CR_EXTERNAL_INT = false;
void UpdateCachedCR()
{
CR_HALT = (g_dsp.cr & 0x4) != 0;
CR_EXTERNAL_INT = (g_dsp.cr & 0x02) != 0;
}
//-------------------------------------------------------------------------------
void (*dsp_op[])(uint16 opc) =
{
dsp_op0, dsp_op1, dsp_op2, dsp_op3,
dsp_op4, dsp_op5, dsp_op6, dsp_op7,
dsp_op8, dsp_op9, dsp_opab, dsp_opab,
dsp_opcd, dsp_opcd, dsp_ope, dsp_opf,
};
void dbg_error(char* err_msg)
{
return;
}
void gdsp_init()
{
g_dsp.irom = (uint16*)malloc(DSP_IROM_SIZE * sizeof(uint16));
g_dsp.iram = (uint16*)malloc(DSP_IRAM_SIZE * sizeof(uint16));
g_dsp.drom = (uint16*)malloc(DSP_DROM_SIZE * sizeof(uint16));
g_dsp.dram = (uint16*)malloc(DSP_DRAM_SIZE * sizeof(uint16));
g_dsp.coef = (uint16*)malloc(DSP_COEF_SIZE * sizeof(uint16));
for (int i = 0; i < DSP_IRAM_SIZE; i++)
{
g_dsp.iram[i] = 0x0021; // HALT opcode
}
for (int i = 0; i < DSP_DRAM_SIZE; i++)
{
g_dsp.dram[i] = 0x0021; // HALT opcode
}
for (int i = 0; i < 32; i++)
{
g_dsp.r[i] = 0;
}
for (int i = 0; i < 4; i++)
{
g_dsp.reg_stack_ptr[i] = 0;
for (int j = 0; j < DSP_STACK_DEPTH; j++)
{
g_dsp.reg_stack[i][j] = 0;
}
}
// copied from a real console after the custom UCode has been loaded
g_dsp.r[0x08] = 0xffff;
g_dsp.r[0x09] = 0xffff;
g_dsp.r[0x0a] = 0xffff;
g_dsp.r[0x0b] = 0xffff;
g_dsp.cr = 0x804;
gdsp_ifx_init();
UpdateCachedCR();
}
void gdsp_reset()
{
// _dbg_assert_msg_(0, "gdsp_reset()");
_dbg_assert_msg_(!g_dsp.exception_in_progress_hack, "assert while exception");
g_dsp.pc = DSP_RESET_VECTOR;
g_dsp.exception_in_progress_hack = false;
}
void gdsp_generate_exception(uint8 level)
{
_dbg_assert_msg_(!g_dsp.exception_in_progress_hack, "assert while exception");
dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
dsp_reg_store_stack(DSP_STACK_D, g_dsp.r[R_SR]);
g_dsp.pc = level * 2;
g_dsp.exception_in_progress_hack = true;
}
uint32 gdsp_exception_ready = 0;
void gdsp_exception(uint8 level)
{
switch (level & 0x7)
{
case 0x5: // ACCA > ACCH exception
if (g_dsp.r[R_SR] & 0x200)
{
gdsp_exception_ready = level;
}
break;
default:
break;
}
}
bool gdsp_load_rom(char* fname)
{
FILE* pFile = fopen(fname, "rb");
if (pFile)
{
fread(g_dsp.irom, 1, DSP_IRAM_SIZE, pFile);
fclose(pFile);
return(true);
}
return(false);
}
bool gdsp_load_coef(char* fname)
{
FILE* pFile = fopen(fname, "rb");
if (pFile)
{
fread(g_dsp.coef, 1, DSP_COEF_SIZE, pFile);
fclose(pFile);
return(true);
}
return(false);
}
void gdsp_write_cr(uint16 val)
{
// reset
if (val & 0x0001)
{
gdsp_reset();
}
val &= ~0x0001;
// update cr
g_dsp.cr = val;
UpdateCachedCR();
}
uint16 gdsp_read_cr()
{
if (g_dsp.pc & 0x8000)
{
g_dsp.cr |= 0x800;
}
else
{
g_dsp.cr &= ~0x800;
}
UpdateCachedCR();
return(g_dsp.cr);
}
// special loop step.. because exception in loop or loopi fails
// dunno how we have to fix it
// atm we execute this instructions directly inside the loop command
// so it cant be interrupted by an exception
void gdsp_loop_step()
{
g_dsp.err_pc = g_dsp.pc;
uint16 opc = dsp_fetch_code();
dsp_op[opc >> 12](opc);
}
void gdsp_step()
{
g_dsp.step_counter++;
g_dsp.err_pc = g_dsp.pc;
uint16 opc = dsp_fetch_code();
dsp_op[opc >> 12](opc);
uint16& rLoopCounter = g_dsp.r[DSP_REG_ST0 + 3];
if (rLoopCounter > 0)
{
const uint16& rCallAddress = g_dsp.r[DSP_REG_ST0 + 0];
const uint16& rLoopAddress = g_dsp.r[DSP_REG_ST0 + 2];
if (g_dsp.pc == (rLoopAddress + 1))
{
rLoopCounter--;
if (rLoopCounter > 0)
{
g_dsp.pc = rCallAddress;
}
else
{
// end of loop
dsp_reg_load_stack(0);
dsp_reg_load_stack(2);
dsp_reg_load_stack(3);
}
}
}
// check if there is an external interrupt
if (CR_EXTERNAL_INT)
{
if (dsp_SR_is_flag_set(FLAG_ENABLE_INTERUPT) && (g_dsp.exception_in_progress_hack == false))
{
gdsp_generate_exception(7);
g_dsp.cr &= ~0x0002;
UpdateCachedCR();
}
// level 7 is the interrupt exception
gdsp_exception_ready = 7;
}
}
bool gdsp_running;
extern volatile uint32 dsp_running;
bool gdsp_run()
{
gdsp_running = true;
while (!CR_HALT)
{
gdsp_step();
}
gdsp_running = false;
return(true);
}
bool gdsp_runx(uint16 cnt)
{
gdsp_running = true;
while (!(g_dsp.cr & 0x4) && gdsp_running)
{
gdsp_step();
cnt--;
if (cnt == 0)
{
break;
}
}
gdsp_running = false;
return(true);
}
void gdsp_stop()
{
gdsp_running = false;
}

View File

@ -0,0 +1,95 @@
/*====================================================================
filename: gdsp_interpreter.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_INTERPRETER_H
#define _GDSP_INTERPRETER_H
#include "Globals.h"
#define DSP_IRAM_SIZE (0x1000)
#define DSP_IRAM_MASK (0x0fff)
#define DSP_IROM_SIZE (0x1000)
#define DSP_IROM_MASK (0x0fff)
#define DSP_DRAM_SIZE (0x1000)
#define DSP_DRAM_MASK (0x0fff)
#define DSP_DROM_SIZE (0x1000)
#define DSP_DROM_MASK (0x0fff)
#define DSP_COEF_SIZE (0x1000)
#define DSP_COEF_MASK (0x0fff)
#define DSP_RESET_VECTOR (0x8000)
#define DSP_STACK_DEPTH 0x20
#define DSP_STACK_MASK 0x1f
struct SDSP
{
static uint16 r[32];
static uint16 pc;
static uint16 err_pc;
static uint16* iram;
static uint16* dram;
static uint16* irom;
static uint16* drom;
static uint16* coef;
static uint8* cpu_ram;
static uint16 cr;
static uint8 reg_stack_ptr[4];
// lets make stack depth to 32 for now
static uint16 reg_stack[4][DSP_STACK_DEPTH];
static void (* irq_request)(void);
// for debugger only
static uint32 iram_crc;
static uint64 step_counter;
static bool exception_in_progress_hack;
};
extern SDSP g_dsp;
void gdsp_init(void);
void gdsp_reset(void);
bool gdsp_load_rom(char* fname);
bool gdsp_load_coef(char* fname);
// steps through DSP code, returns false if error occured
void gdsp_step(void);
void gdsp_loop_step();
bool gdsp_run(void);
bool gdsp_runx(uint16 cnt);
void gdsp_stop(void);
void gdsp_write_cr(uint16 val);
uint16 gdsp_read_cr(void);
uint16* gdsp_get_iram(void);
uint16* gdsp_get_irom(void);
uint16* gdsp_get_dram(void);
uint16* gdsp_get_drom(void);
#endif

View File

@ -0,0 +1,156 @@
/*====================================================================
filename: gdsp_memory.cpp
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include <stdio.h>
#include "Globals.h"
#include "gdsp_interpreter.h"
#include "gdsp_memory.h"
#include "gdsp_ifx.h"
uint16 dsp_swap16(uint16 x)
{
return((x >> 8) | (x << 8));
}
uint16* gdsp_get_iram(void)
{
return(g_dsp.iram);
}
uint16* gdsp_get_irom(void)
{
return(g_dsp.irom);
}
uint16* gdsp_get_dram(void)
{
return(g_dsp.dram);
}
uint16* gdsp_get_drom(void)
{
return(g_dsp.drom);
}
uint16 dsp_imem_read(uint16 addr)
{
uint16 opc;
if (g_dsp.pc & 0x8000)
{
opc = g_dsp.irom[addr & DSP_IROM_MASK];
}
else
{
opc = g_dsp.iram[addr & DSP_IRAM_MASK];
}
return(dsp_swap16(opc));
}
uint16 dsp_dmem_read(uint16 addr)
{
uint16 val;
switch (addr >> 12)
{
case 0x1: // 1xxx COEF
val = g_dsp.coef[addr & DSP_DROM_MASK];
val = dsp_swap16(val);
break;
case 0x8: // 8xxx DROM
DebugLog("someone reads from ROM\n");
val = g_dsp.drom[addr & DSP_DROM_MASK];
val = dsp_swap16(val);
break;
case 0xf: // Fxxx HW regs
val = gdsp_ifx_read(addr);
break;
case 0x0: // 0xxx DRAM
val = g_dsp.dram[addr & DSP_DRAM_MASK];
val = dsp_swap16(val);
break;
default: // error
// ErrorLog("%04x DSP ERROR: Read from UNKNOWN (%04x) memory\n", g_dsp.pc, addr);
val = 0;
break;
}
return(val);
}
bool dsp_dmem_write(uint16 addr, uint16 val)
{
switch (addr >> 12)
{
case 0x8: // 8xxx DROM
DebugLog("someone writes to ROM\n");
/* val = dsp_swap16(val);
g_dsp.drom[addr & DSP_DROM_MASK] = val;*/
break;
case 0xf: // Fxxx HW regs
gdsp_ifx_write(addr, val);
break;
case 0x0: // 0xxx DRAM
val = dsp_swap16(val);
g_dsp.dram[addr & DSP_DRAM_MASK] = val;
break;
default: // error
DebugLog("%04x DSP ERROR: Write to UNKNOWN (%04x) memory\n", g_dsp.pc, addr);
break;
}
return(true);
}
uint16 dsp_fetch_code(void)
{
uint16 opc = dsp_imem_read(g_dsp.pc);
g_dsp.pc++;
return(opc);
}
uint16 dsp_peek_code(void)
{
return(dsp_imem_read(g_dsp.pc));
}

View File

@ -0,0 +1,37 @@
/*====================================================================
filename: gdsp_memory.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_MEMORY_H
#define _GDSP_MEMORY_H
#include "Globals.h"
uint16 dsp_fetch_code(void);
uint16 dsp_peek_code(void);
uint16 dsp_imem_read(uint16 addr);
bool dsp_dmem_write(uint16 addr, uint16 val);
uint16 dsp_dmem_read(uint16 addr);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
/*====================================================================
filename: gdsp_opcodes.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_H
#define _GDSP_OPCODES_H
#include "Globals.h"
void dsp_op0(uint16 opc);
void dsp_op1(uint16 opc);
void dsp_op2(uint16 opc);
void dsp_op3(uint16 opc);
void dsp_op4(uint16 opc);
void dsp_op5(uint16 opc);
void dsp_op6(uint16 opc);
void dsp_op7(uint16 opc);
void dsp_op8(uint16 opc);
void dsp_op9(uint16 opc);
void dsp_opab(uint16 opc);
void dsp_opcd(uint16 opc);
void dsp_ope(uint16 opc);
void dsp_opf(uint16 opc);
#define R_SR 0x13
#define FLAG_ENABLE_INTERUPT 11
extern inline bool dsp_SR_is_flag_set(uint8 flag);
#endif

View File

@ -0,0 +1,227 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_OPCODES_HELPER_H
#define _GDSP_OPCODES_HELPER_H
#include "Globals.h"
// ---------------------------------------------------------------------------------------
//
// --- SR
//
// ---------------------------------------------------------------------------------------
inline void dsp_SR_set_flag(uint8 flag)
{
g_dsp.r[R_SR] |= (1 << flag);
}
inline bool dsp_SR_is_flag_set(uint8 flag)
{
return((g_dsp.r[R_SR] & (1 << flag)) > 0);
}
// ---------------------------------------------------------------------------------------
//
// --- reg
//
// ---------------------------------------------------------------------------------------
inline uint16 dsp_op_read_reg(uint8 reg)
{
uint16 val;
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
val = dsp_reg_load_stack(reg - 0x0c);
break;
default:
val = g_dsp.r[reg];
break;
}
return(val);
}
inline void dsp_op_write_reg(uint8 reg, uint16 val)
{
switch (reg & 0x1f)
{
case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
dsp_reg_store_stack(reg - 0x0c, val);
break;
default:
g_dsp.r[reg] = val;
break;
}
}
// ---------------------------------------------------------------------------------------
//
// --- prod
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_prod()
{
sint64 val;
sint64 low_prod;
val = (sint8)g_dsp.r[0x16];
val <<= 32;
low_prod = g_dsp.r[0x15];
low_prod += g_dsp.r[0x17];
low_prod <<= 16;
low_prod |= g_dsp.r[0x14];
val += low_prod;
return(val);
}
inline void dsp_set_long_prod(sint64 val)
{
g_dsp.r[0x14] = (uint16)val;
val >>= 16;
g_dsp.r[0x15] = (uint16)val;
val >>= 16;
g_dsp.r[0x16] = (uint16)val;
g_dsp.r[0x17] = 0;
}
// ---------------------------------------------------------------------------------------
//
// --- acc
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acc(uint8 reg)
{
_dbg_assert_(reg < 2);
sint64 val;
sint64 low_acc;
val = (sint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline uint64 dsp_get_ulong_acc(uint8 reg)
{
_dbg_assert_(reg < 2);
uint64 val;
uint64 low_acc;
val = (uint8)g_dsp.r[0x10 + reg];
val <<= 32;
low_acc = g_dsp.r[0x1e + reg];
low_acc <<= 16;
low_acc |= g_dsp.r[0x1c + reg];
val |= low_acc;
return(val);
}
inline void dsp_set_long_acc(uint8 _reg, sint64 val)
{
_dbg_assert_(_reg < 2);
g_dsp.r[0x1c + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x1e + _reg] = (uint16)val;
val >>= 16;
g_dsp.r[0x10 + _reg] = (uint16)val;
}
inline sint16 dsp_get_acc_l(uint8 _reg)
{
_dbg_assert_(_reg < 2);
return(g_dsp.r[0x1c + _reg]);
}
inline sint16 dsp_get_acc_m(uint8 _reg)
{
_dbg_assert_(_reg < 2);
return(g_dsp.r[0x1e + _reg]);
}
sint16 dsp_get_acc_h(uint8 _reg)
{
_dbg_assert_(_reg < 2);
return(g_dsp.r[0x10 + _reg]);
}
// ---------------------------------------------------------------------------------------
//
// --- acx
//
// ---------------------------------------------------------------------------------------
inline sint64 dsp_get_long_acx(uint8 _reg)
{
_dbg_assert_(_reg < 2);
sint64 val = (sint16)g_dsp.r[0x1a + _reg];
val <<= 16;
sint64 low_acc = g_dsp.r[0x18 + _reg];
val |= low_acc;
return(val);
}
inline sint16 dsp_get_ax_l(uint8 _reg)
{
_dbg_assert_(_reg < 2);
return(g_dsp.r[0x18 + _reg]);
}
inline sint16 dsp_get_ax_h(uint8 _reg)
{
_dbg_assert_(_reg < 2);
return(g_dsp.r[0x1a + _reg]);
}
#endif

View File

@ -0,0 +1,62 @@
/*====================================================================
filename: gdsp_registers.cpp
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include "Globals.h"
#include "gdsp_registers.h"
#include "gdsp_interpreter.h"
void dsp_reg_stack_push(uint8 stack_reg)
{
g_dsp.reg_stack_ptr[stack_reg]++;
g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]] = g_dsp.r[DSP_REG_ST0 + stack_reg];
}
void dsp_reg_stack_pop(uint8 stack_reg)
{
g_dsp.r[DSP_REG_ST0 + stack_reg] = g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]];
g_dsp.reg_stack_ptr[stack_reg]--;
g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
}
void dsp_reg_store_stack(uint8 stack_reg, uint16 val)
{
dsp_reg_stack_push(stack_reg);
g_dsp.r[DSP_REG_ST0 + stack_reg] = val;
}
uint16 dsp_reg_load_stack(uint8 stack_reg)
{
uint16 val = g_dsp.r[DSP_REG_ST0 + stack_reg];
dsp_reg_stack_pop(stack_reg);
return(val);
}

View File

@ -0,0 +1,42 @@
/*====================================================================
filename: gdsp_registers.h
project: GCemu
created: 2004-6-18
mail: duddie@walla.com
Copyright (c) 2005 Duddie & Tratax
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _GDSP_REGISTERS_H
#define _GDSP_REGISTERS_H
#include "Globals.h"
#define DSP_REG_ST0 0x0c
#define DSP_REG_ST1 0x0c
#define DSP_REG_ST2 0x0c
#define DSP_REG_ST3 0x0c
#define DSP_STACK_C 0
#define DSP_STACK_D 1
void dsp_reg_store_stack(uint8 stack_reg, uint16 val);
uint16 dsp_reg_load_stack(uint8 stack_reg);
#endif

View File

@ -0,0 +1,291 @@
// 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 "gdsp_interpreter.h"
#include "gdsp_interface.h"
#include "disassemble.h"
#ifdef _WIN32
#include "DisAsmDlg.h"
#include "DSoundStream.h"
HINSTANCE g_hInstance = NULL;
HANDLE g_hDSPThread = NULL;
CRITICAL_SECTION g_CriticalSection;
#endif
DSPInitialize g_dspInitialize;
CDisAsmDlg g_Dialog;
#define GDSP_MBOX_CPU 0
#define GDSP_MBOX_DSP 1
uint32 g_LastDMAAddress = 0;
uint32 g_LastDMASize = 0;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}
g_hInstance = hinstDLL;
return(TRUE);
}
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DSound)");
#else
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin Debug (DSound)");
#endif
}
void DllAbout(HWND _hParent)
{}
void DllConfig(HWND _hParent)
{}
void DllDebugger(HWND _hParent)
{
#if defined (_DEBUG) && defined (_WIN32)
g_Dialog.Create(NULL); //_hParent);
g_Dialog.ShowWindow(SW_SHOW);
#endif
}
DWORD WINAPI dsp_thread(LPVOID lpParameter)
{
while (1)
{
if (!gdsp_run())
{
ErrorLog("*** DSP: CRITICAL ERROR ***\n");
//return 0;
exit(0);
}
}
}
DWORD WINAPI dsp_thread_debug(LPVOID lpParameter)
{
while (1)
{
if (g_Dialog.CanDoStep())
{
gdsp_runx(1);
}
else
{
Sleep(100);
}
}
}
void DSP_DebugBreak()
{
#ifdef _WIN32
#ifdef _DEBUG
g_Dialog.DebugBreak();
#endif
#endif
}
void dspi_req_dsp_irq()
{
g_dspInitialize.pGenerateDSPInterrupt();
}
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels)
{}
void DSP_Initialize(DSPInitialize _dspInitialize)
{
{
g_dspInitialize = _dspInitialize;
gdsp_init();
g_dsp.step_counter = 0;
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
g_dsp.irq_request = dspi_req_dsp_irq;
gdsp_reset();
if (!gdsp_load_rom("data\\dsp_rom.bin"))
{
ErrorLog("Cannot load DSP ROM\n");
}
if (!gdsp_load_coef("data\\dsp_coef.bin"))
{
ErrorLog("Cannot load DSP COEF\n");
}
/* Dump UCode to file...
FILE* t = fopen("e:\\hmm.txt", "wb");
gd_globals_t gdg;
gd_dis_file(&gdg, "D:\\DSP_UCode.bin", t);
fclose(t); */
}
#if _DEBUG
g_hDSPThread = CreateThread(NULL, 0, dsp_thread_debug, 0, 0, NULL);
#else
g_hDSPThread = CreateThread(NULL, 0, dsp_thread, 0, 0, NULL);
#endif
InitializeCriticalSection(&g_CriticalSection);
DSound::DSound_StartSound((HWND)g_dspInitialize.hWnd, 32000, Mixer);
}
void DSP_Shutdown(void)
{
if (g_hDSPThread != NULL)
{
TerminateThread(g_hDSPThread, 0);
}
}
unsigned __int16 DSP_WriteControlRegister(unsigned __int16 _uFlag)
{
gdsp_write_cr(_uFlag);
return(gdsp_read_cr());
}
unsigned __int16 DSP_ReadControlRegister()
{
return(gdsp_read_cr());
}
unsigned __int16 DSP_ReadMailboxHigh(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return(gdsp_mbox_read_h(GDSP_MBOX_CPU));
}
else
{
return(gdsp_mbox_read_h(GDSP_MBOX_DSP));
}
}
unsigned __int16 DSP_ReadMailboxLow(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return(gdsp_mbox_read_l(GDSP_MBOX_CPU));
}
else
{
return(gdsp_mbox_read_l(GDSP_MBOX_DSP));
}
}
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned __int16 _uHighMail)
{
if (_CPUMailbox)
{
if (gdsp_mbox_peek(GDSP_MBOX_CPU) & 0x80000000)
{
ErrorLog("Mailbox isnt empty ... strange");
}
gdsp_mbox_write_h(GDSP_MBOX_CPU, _uHighMail);
}
else
{
ErrorLog("CPU cant write to DSP mailbox");
}
}
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned __int16 _uLowMail)
{
if (_CPUMailbox)
{
gdsp_mbox_write_l(GDSP_MBOX_CPU, _uLowMail);
DebugLog("Write CPU Mail: 0x%08x (pc=0x%04x)\n", gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.err_pc);
}
else
{
ErrorLog("CPU cant write to DSP mailbox");
}
}
void DSP_Update()
{
if (g_hDSPThread)
{
return;
}
if (g_Dialog.CanDoStep())
{
gdsp_runx(100);
}
}
void DSP_SendAIBuffer(unsigned __int32 _Address, unsigned __int32 _Size)
{
uint32 Size = _Size * 16 * 2; // 16bit per sample, two channels
g_LastDMAAddress = _Address;
g_LastDMASize = Size;
}

View File

@ -0,0 +1,237 @@
/*====================================================================
filename: opcodes.cpp
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#include "Globals.h"
#include "opcodes.h"
opc_t opcodes[] =
{
{"NOP", 0x0000, 0xffff, 1, 0, {},},
{"HALT", 0x0021, 0xffff, 1, 0, {},},
{"RET", 0x02df, 0xffff, 1, 0, {},},
{"RETEQ", 0x02d5, 0xffff, 1, 0, {},},
{"RETNZ", 0x02dd, 0xffff, 1, 0, {},},
{"RTI", 0x02ff, 0xffff, 1, 0, {},},
{"CALL", 0x02bf, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"CALLNE", 0x02b4, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"IF_0", 0x0270, 0xffff, 1, 0, {},},
{"IF_1", 0x0271, 0xffff, 1, 0, {},},
{"IF_2", 0x0272, 0xffff, 1, 0, {},},
{"IF_3", 0x0273, 0xffff, 1, 0, {},},
{"IF_E", 0x0274, 0xffff, 1, 0, {},},
{"IF_Q", 0x0275, 0xffff, 1, 0, {},},
{"IF_R", 0x027c, 0xffff, 1, 0, {},},
{"IF_Z", 0x027d, 0xffff, 1, 0, {},},
{"IF_P", 0x027f, 0xffff, 1, 0, {},},
{"JX0", 0x0290, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JX1", 0x0291, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JX2", 0x0292, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JX3", 0x0293, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JNE", 0x0294, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JEQ", 0x0295, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JZR", 0x029c, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JNZ", 0x029d, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"JMP", 0x029f, 0xffff, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}},},
{"DAR", 0x0004, 0xfffc, 1, 1, {{P_REG, 1, 0, 0, 0x0003}},},
{"IAR", 0x0008, 0xfffc, 1, 1, {{P_REG, 1, 0, 0, 0x0003}},},
{"CALLR", 0x171f, 0xff1f, 1, 1, {{P_REG, 1, 0, 5, 0x00e0}},},
{"JMPR", 0x170f, 0xff1f, 1, 1, {{P_REG, 1, 0, 5, 0x00e0}},},
{"SBCLR", 0x1200, 0xfff8, 1, 1, {{P_IMM, 1, 0, 0, 0x0007}},},
{"SBSET", 0x1300, 0xfff8, 1, 1, {{P_IMM, 1, 0, 0, 0x0007}},},
{"LSL", 0x1400, 0xfec0, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}},},
{"LSR", 0x1440, 0xfec0, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}},},
{"ASL", 0x1480, 0xfec0, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}},},
{"ASR", 0x14c0, 0xfec0, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}},},
{"LRI", 0x0080, 0xffe0, 2, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_IMM, 2, 1, 0, 0xffff}},},
{"LR", 0x00c0, 0xffe0, 2, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_MEM, 2, 1, 0, 0xffff}},},
{"SR", 0x00e0, 0xffe0, 2, 2, {{P_MEM, 2, 1, 0, 0xffff}, {P_REG, 1, 0, 0, 0x001f}},},
{"MRR", 0x1c00, 0xfc00, 1, 2, {{P_REG, 1, 0, 5, 0x03e0}, {P_REG, 1, 0, 0, 0x001f}},},
{"SI", 0x1600, 0xff00, 2, 2, {{P_MEM, 1, 0, 0, 0x00ff}, {P_IMM, 2, 1, 0, 0xffff}},},
{"LRS", 0x2000, 0xf800, 1, 2, {{P_REG18, 1, 0, 8, 0x0700}, {P_MEM, 1, 0, 0, 0x00ff}},},
{"SRS", 0x2800, 0xf800, 1, 2, {{P_MEM, 1, 0, 0, 0x00ff}, {P_REG18, 1, 0, 8, 0x0700}},},
{"LRIS", 0x0800, 0xf800, 1, 2, {{P_REG18, 1, 0, 8, 0x0700}, {P_IMM, 1, 0, 0, 0x00ff}},},
{"ADDIS", 0x0400, 0xfe00, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}},},
{"CMPIS", 0x0600, 0xfe00, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x00ff}},},
{"ANDI", 0x0240, 0xfeff, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"ANDF", 0x02c0, 0xfeff, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"XORI", 0x0220, 0xfeff, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"ANDCF", 0x02a0, 0xfeff, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"ORI", 0x0260, 0xfeff, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"ORF", 0x02e0, 0xfeff, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},},
{"ADDI", 0x0200, 0xfeff, 2, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},}, // missing S64
{"CMPI", 0x0280, 0xfeff, 2, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 2, 1, 0, 0xffff}},}, // missing S64
{"ILRR", 0x0210, 0xfedc, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_PRG, 1, 0, 0, 0x0003}},},
{"ILRRI", 0x0218, 0xfedc, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_PRG, 1, 0, 0, 0x0003}},},
// load and store value pointed by indexing reg and increment; LRR/SRR variants
{"LRRI", 0x1900, 0xff80, 1, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_PRG, 1, 0, 5, 0x0060}},},
{"LRRD", 0x1880, 0xff80, 1, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_PRG, 1, 0, 5, 0x0060}},},
{"LRRN", 0x1980, 0xff80, 1, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_PRG, 1, 0, 5, 0x0060}},},
{"LRR", 0x1800, 0xff80, 1, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_PRG, 1, 0, 5, 0x0060}},},
{"SRRI", 0x1b00, 0xff80, 1, 2, {{P_PRG, 1, 0, 5, 0x0060}, {P_REG, 1, 0, 0, 0x001f}},},
{"SRRD", 0x1a80, 0xff80, 1, 2, {{P_PRG, 1, 0, 5, 0x0060}, {P_REG, 1, 0, 0, 0x001f}},},
{"SRRN", 0x1b80, 0xff80, 1, 2, {{P_PRG, 1, 0, 5, 0x0060}, {P_REG, 1, 0, 0, 0x001f}},},
{"SRR", 0x1a00, 0xff80, 1, 2, {{P_PRG, 1, 0, 5, 0x0060}, {P_REG, 1, 0, 0, 0x001f}},},
{"LOOPI", 0x1000, 0xff00, 1, 1, {{P_IMM, 1, 0, 0, 0x00ff}},},
{"BLOOPI", 0x1100, 0xff00, 2, 2, {{P_IMM, 1, 0, 0, 0x00ff}, {P_VAL, 2, 1, 0, 0xffff}},},
{"LOOP", 0x0040, 0xffe0, 1, 1, {{P_REG, 1, 0, 0, 0x001f}},},
{"BLOOP", 0x0060, 0xffe0, 2, 2, {{P_REG, 1, 0, 0, 0x001f}, {P_VAL, 2, 1, 0, 0xffff}},},
// opcodes that can be extended
// extended opcodes, note size of opcode will be set to 0
{"NX", 0x8000, 0xffff, 1 | P_EXT, 0, {},},
{"S40", 0x8e00, 0xffff, 1 | P_EXT, 0, {},},
{"S16", 0x8f00, 0xffff, 1 | P_EXT, 0, {},},
{"M2", 0x8a00, 0xffff, 1 | P_EXT, 0, {},},
{"M0", 0x8b00, 0xffff, 1 | P_EXT, 0, {},},
{"CLR15", 0x8c00, 0xffff, 1 | P_EXT, 0, {},},
{"SET15", 0x8d00, 0xffff, 1 | P_EXT, 0, {},},
{"DECM", 0x7800, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"INCM", 0x7400, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"DEC", 0x7a00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"INC", 0x7600, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"NEG", 0x7c00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"TST", 0xb100, 0xf7ff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}},},
{"TSTAXH", 0x8600, 0xfeff, 1 | P_EXT, 1, {{P_REG1A, 1, 0, 8, 0x0100}},},
{"CMP", 0x8200, 0xffff, 1 | P_EXT, 0, {},},
{"CMPAXH", 0xc100, 0xe7ff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 12, 0x1000}, {P_REG1A, 1, 0, 11, 0x0800}},},
{"CLR", 0x8100, 0xf7ff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}},},
{"CLRP", 0x8400, 0xffff, 1 | P_EXT, 0, {},},
{"MOV", 0x6c00, 0xfeff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}},},
{"MOVAX", 0x6800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}},},
{"MOVR", 0x6000, 0xf8ff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}},},
{"MOVP", 0x6e00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"MOVPZ", 0xfe00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"ADDPAXZ", 0xf800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 9, 0x0200}, {P_REG1A, 1, 0, 8, 0x0100}},},
{"ADDP", 0x4e00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"LSL16", 0xf000, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"LSR16", 0xf400, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"ASR16", 0x9100, 0xf7ff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}},},
{"XORR", 0x3000, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}},},
{"ANDR", 0x3400, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}},},
{"ORR", 0x3800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}},},
{"ANDC", 0x3C00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"ORC", 0x3E00, 0xfeff, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}},},
{"MULX", 0xa000, 0xe7ff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 11, 0x1000}, {P_REG19, 1, 0, 10, 0x0800}},},
{"MULXAC", 0xa400, 0xe6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x1000}, {P_REG19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULXMV", 0xa600, 0xe6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x1000}, {P_REG19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULXMVZ", 0xa200, 0xe6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x1000}, {P_REG19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MUL", 0x9000, 0xf7ff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}},},
{"MULAC", 0x9400, 0xf6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULMV", 0x9600, 0xf6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULMVZ", 0x9200, 0xf6ff, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULC", 0xc000, 0xe7ff, 1 | P_EXT, 2, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}},},
{"MULCAC", 0xc400, 0xe6ff, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULCMV", 0xc600, 0xe6ff, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"MULCMVZ", 0xc200, 0xe6ff, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}},},
{"ADDR", 0x4000, 0xf8ff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}},},
{"ADDAX", 0x4800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}},},
{"ADD", 0x4c00, 0xfeff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}},},
{"ADDAXL", 0x7000, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}},},
{"SUBR", 0x5000, 0xf8ff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}},},
{"SUBAX", 0x5800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}},},
{"SUB", 0x5c00, 0xfeff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}},},
{"MADD", 0xf200, 0xfeff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}},},
{"MSUB", 0xf600, 0xfeff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}},},
{"MADDX", 0xe000, 0xfcff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0200}, {P_REG19, 1, 0, 7, 0x0100}},},
{"MSUBX", 0xe400, 0xfcff, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0200}, {P_REG19, 1, 0, 7, 0x0100}},},
{"MADDC", 0xe800, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 9, 0x0200}, {P_REG19, 1, 0, 7, 0x0100}},},
{"MSUBC", 0xec00, 0xfcff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 9, 0x0200}, {P_REG19, 1, 0, 7, 0x0100}},},
// assemble CW
{"CW", 0x0000, 0xffff, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}},},
// unknown opcode for disassemble
{"CW", 0x0000, 0x0000, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}},},
};
opc_t opcodes_ext[] =
{
{"L", 0x0040, 0x00c4, 1, 2, {{P_REG18, 1, 0, 3, 0x0038}, {P_PRG, 1, 0, 0, 0x0003}},},
{"LN", 0x0044, 0x00c4, 1, 2, {{P_REG18, 1, 0, 3, 0x0038}, {P_PRG, 1, 0, 0, 0x0003}},},
{"LS", 0x0080, 0x00ce, 1, 2, {{P_REG18, 1, 0, 4, 0x0030}, {P_ACCM, 1, 0, 0, 0x0001}},},
{"LSN", 0x0084, 0x00ce, 1, 2, {{P_REG18, 1, 0, 4, 0x0030}, {P_ACCM, 1, 0, 0, 0x0001}},},
{"LSM", 0x0088, 0x00ce, 1, 2, {{P_REG18, 1, 0, 4, 0x0030}, {P_ACCM, 1, 0, 0, 0x0001}},},
{"LSNM", 0x008c, 0x00ce, 1, 2, {{P_REG18, 1, 0, 4, 0x0030}, {P_ACCM, 1, 0, 0, 0x0001}},},
{"SL", 0x0082, 0x00ce, 1, 2, {{P_ACCM, 1, 0, 0, 0x0001}, {P_REG18, 1, 0, 4, 0x0030}},},
{"SLN", 0x0086, 0x00ce, 1, 2, {{P_ACCM, 1, 0, 0, 0x0001}, {P_REG18, 1, 0, 4, 0x0030}},},
{"SLM", 0x008a, 0x00ce, 1, 2, {{P_ACCM, 1, 0, 0, 0x0001}, {P_REG18, 1, 0, 4, 0x0030}},},
{"SLNM", 0x008e, 0x00ce, 1, 2, {{P_ACCM, 1, 0, 0, 0x0001}, {P_REG18, 1, 0, 4, 0x0030}},},
{"S", 0x0020, 0x00e4, 1, 2, {{P_PRG, 1, 0, 0, 0x0003}, {P_REG1C, 1, 0, 3, 0x0018}},},
{"SN", 0x0024, 0x00e4, 1, 2, {{P_PRG, 1, 0, 0, 0x0003}, {P_REG1C, 1, 0, 3, 0x0018}},},
{"LDX", 0x00c0, 0x00cf, 1, 3, {{P_REG18, 1, 0, 4, 0x0010}, {P_REG1A, 1, 0, 4, 0x0010}, {P_PRG, 1, 0, 5, 0x0020}},},
{"LDXN", 0x00c4, 0x00cf, 1, 3, {{P_REG18, 1, 0, 4, 0x0010}, {P_REG1A, 1, 0, 4, 0x0010}, {P_PRG, 1, 0, 5, 0x0020}},},
{"LDXM", 0x00c8, 0x00cf, 1, 3, {{P_REG18, 1, 0, 4, 0x0010}, {P_REG1A, 1, 0, 4, 0x0010}, {P_PRG, 1, 0, 5, 0x0020}},},
{"LDXNM", 0x00cc, 0x00cf, 1, 3, {{P_REG18, 1, 0, 4, 0x0010}, {P_REG1A, 1, 0, 4, 0x0010}, {P_PRG, 1, 0, 5, 0x0020}},},
{"LD", 0x00c0, 0x00cc, 1, 3, {{P_REG18, 1, 0, 4, 0x0020}, {P_REG19, 1, 0, 3, 0x0010}, {P_PRG, 1, 0, 0, 0x0003}},},
{"LDN", 0x00c4, 0x00cc, 1, 3, {{P_REG18, 1, 0, 4, 0x0020}, {P_REG19, 1, 0, 3, 0x0010}, {P_PRG, 1, 0, 0, 0x0003}},},
{"LDM", 0x00c8, 0x00cc, 1, 3, {{P_REG18, 1, 0, 4, 0x0020}, {P_REG19, 1, 0, 3, 0x0010}, {P_PRG, 1, 0, 0, 0x0003}},},
{"LDNM", 0x00cc, 0x00cc, 1, 3, {{P_REG18, 1, 0, 4, 0x0020}, {P_REG19, 1, 0, 3, 0x0010}, {P_PRG, 1, 0, 0, 0x0003}},},
{"MV", 0x0010, 0x00f0, 1, 2, {{P_REG18, 1, 0, 2, 0x000c}, {P_REG1C, 1, 0, 0, 0x0003}},},
{"DR", 0x0004, 0x00fc, 1, 1, {{P_REG, 1, 0, 0, 0x0003}},},
{"IR", 0x0008, 0x00fc, 1, 1, {{P_REG, 1, 0, 0, 0x0003}},},
{"NR", 0x000c, 0x00fc, 1, 1, {{P_REG, 1, 0, 0, 0x0003}},},
{"XXX", 0x0000, 0x0000, 1, 1, {{P_VAL, 1, 0, 0, 0x00ff}},},
};
const uint32 opcodes_size = sizeof(opcodes) / sizeof(opc_t);
const uint32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(opc_t);

View File

@ -0,0 +1,86 @@
/*====================================================================
filename: opcodes.h
project: GameCube DSP Tool (gcdsp)
created: 2005.03.04
mail: duddie@walla.com
Copyright (c) 2005 Duddie
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; either version 2
of the License, or (at your option) any later version.
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
====================================================================*/
#ifndef _OPCODES_H
#define _OPCODES_H
typedef enum partype_t
{
P_NONE = 0x0000,
P_VAL = 0x0001,
P_IMM = 0x0002,
P_MEM = 0x0003,
P_STR = 0x0004,
P_REG = 0x8000,
P_REG08 = P_REG | 0x0800,
P_REG10 = P_REG | 0x1000,
P_REG18 = P_REG | 0x1800,
P_REG19 = P_REG | 0x1900,
P_REG1A = P_REG | 0x1a00,
P_REG1C = P_REG | 0x1c00,
P_ACCM = P_REG | 0x1e00,
P_ACCM_D = P_REG | 0x1e80,
P_ACC = P_REG | 0x2000,
P_ACC_D = P_REG | 0x2080,
P_AX = P_REG | 0x2200,
P_AX_D = P_REG | 0x2280,
P_REGS_MASK = 0x03f80,
P_REF = P_REG | 0x4000,
P_PRG = P_REF | P_REG,
};
#define P_EXT 0x80
typedef struct opcpar_t
{
partype_t type;
uint8 size;
uint8 loc;
sint8 lshift;
uint16 mask;
} opcpar_t;
typedef struct opc_t
{
const char* name;
uint16 opcode;
uint16 opcode_mask;
uint8 size;
uint8 param_count;
opcpar_t params[8];
} opc_t;
extern opc_t opcodes[];
extern const uint32 opcodes_size;
extern opc_t opcodes_ext[];
extern const uint32 opcodes_ext_size;
inline uint16 swap16(uint16 x)
{
return((x >> 8) | (x << 8));
}
#endif

View File

@ -0,0 +1,19 @@
// 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"

View File

@ -0,0 +1,36 @@
// 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
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#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"

View File

@ -0,0 +1,805 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Plugin_DSP_NULL"
ProjectGUID="{9AC65CBE-7854-4A86-AA10-D73FF9E5D61F}"
RootNamespace="Plugin_DSP_NULL"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_NULLD.dll"
LinkIncremental="2"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/DSP_HLE.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_NULLD.dll"
LinkIncremental="2"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/DSP_HLE.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
FloatingPointModel="2"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_NULL.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
FloatingPointModel="2"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_NULL.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
FloatingPointModel="2"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_NULL.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../Core/Common/Src;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
FloatingPointModel="2"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_NULL.dll"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/DSP_HLE.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\Src\resource.h"
>
</File>
<File
RelativePath=".\Src\resource.rc"
>
</File>
</Filter>
<Filter
Name="PCHW"
>
<File
RelativePath=".\Src\Pchw\DSoundStream.cpp"
>
</File>
<File
RelativePath=".\Src\Pchw\DSoundStream.h"
>
</File>
<File
RelativePath=".\Src\Pchw\Mixer.cpp"
>
</File>
<File
RelativePath=".\Src\Pchw\Mixer.h"
>
</File>
</Filter>
<Filter
Name="UCodes"
>
<File
RelativePath=".\Src\UCodes\UCode_CARD.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_CARD.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_InitAudioSystem.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_InitAudioSystem.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_Jac.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_Jac.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_ROM.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_ROM.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_Zelda.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_Zelda.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCodes.cpp"
>
</File>
<File
RelativePath=".\Src\UCodes\UCodes.h"
>
</File>
<Filter
Name="UCode AX"
>
<File
RelativePath=".\Src\UCodes\UCode_AX.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="4"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\UCodes\UCode_AX.h"
>
</File>
<File
RelativePath=".\Src\UCodes\UCode_AXLib.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="AboutDialog"
>
<File
RelativePath=".\Src\AboutDlg.cpp"
>
</File>
<File
RelativePath=".\Src\AboutDlg.h"
>
</File>
</Filter>
<Filter
Name="ConfigDialog"
>
<File
RelativePath=".\Src\ConfigDlg.cpp"
>
</File>
<File
RelativePath=".\Src\ConfigDlg.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\Config.cpp"
>
</File>
<File
RelativePath=".\Src\Config.h"
>
</File>
<File
RelativePath=".\Src\DSPHandler.cpp"
>
</File>
<File
RelativePath=".\Src\DSPHandler.h"
>
</File>
<File
RelativePath=".\Src\Globals.cpp"
>
</File>
<File
RelativePath=".\Src\Globals.h"
>
</File>
<File
RelativePath=".\Src\MailHandler.cpp"
>
</File>
<File
RelativePath=".\Src\MailHandler.h"
>
</File>
<File
RelativePath=".\Src\main.cpp"
>
</File>
<File
RelativePath=".\Src\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\stdafx.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,38 @@
// 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 "resource.h"
#include "AboutDlg.h"
LRESULT
CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(GetParent());
return(TRUE);
}
LRESULT
CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return(0);
}

View File

@ -0,0 +1,41 @@
// 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
class CAboutDlg
: public CDialogImpl<CAboutDlg>
{
public:
enum { IDD = IDD_ABOUT };
BEGIN_MSG_MAP(CAboutDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
};

View File

@ -0,0 +1,87 @@
// 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 "Common.h"
#include "IniFile.h"
#include "Config.h"
CConfig g_Config;
CConfig::CConfig()
{
Load();
}
void
CConfig::LoadDefaults()
{
m_EnableHLEAudio = true;
m_EnableDTKMusic = true;
m_Interpolation = true;
m_DumpSampleMinLength = true;
m_SampleRate = 48000;
m_DumpSamples = false;
m_AntiGap = false;
}
void
CConfig::Load()
{
// first load defaults
LoadDefaults();
IniFile file;
file.Load("DSP.ini");
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true);
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
file.Get("Config", "Interpolation", &m_Interpolation, true);
file.Get("Config", "DumpSamples", &m_DumpSamples, false);
file.Get("Config", "DumpSampleMinLength", &m_DumpSampleMinLength, true);
#ifdef _WIN32
file.Get("Config", "DumpSamplePath", &m_szSamplePath, "C:\\");
#else
file.Get("Config", "DumpSamplePath", &m_szSamplePath, "/dev/null/");
#endif
file.Get("Config", "SampleRate", &m_SampleRate, 48000);
file.Get("Config", "AntiGap", &m_AntiGap, false);
}
void
CConfig::Save()
{
IniFile file;
file.Load("DSP.ini");
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio);
file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic);
file.Set("Config", "Interpolation", m_Interpolation);
file.Set("Config", "DumpSamples", m_DumpSamples);
file.Set("Config", "DumpSampleMinLength", m_DumpSampleMinLength);
#ifdef _WIN32
file.Set("Config", "DumpSamplePath", m_szSamplePath);
#else
file.Set("Config", "DumpSamplePath", m_szSamplePath);
#endif
file.Set("Config", "SampleRate", m_SampleRate);
file.Set("Config", "AntiGap", m_AntiGap);
file.Save("DSP.ini");
}

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 _CONFIG_H
#define _CONFIG_H
#include <string>
struct CConfig
{
bool m_AntiGap;
bool m_EnableHLEAudio;
bool m_EnableDTKMusic;
bool m_Interpolation;
bool m_DumpSamples;
std::string m_szSamplePath;
int m_SampleRate;
bool m_DumpSampleMinLength;
CConfig();
void LoadDefaults();
void Load();
void Save();
};
extern CConfig g_Config;
#endif

View File

@ -0,0 +1,70 @@
// 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 "resource.h"
#include "Config.h"
#include "ConfigDlg.h"
LRESULT
CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
g_Config.Load();
//CenterWindow(this->GetParent());
CenterWindow(GetParent());
m_buttonEnableHLEAudio = GetDlgItem(IDC_ENABLE_HLE_AUDIO);
m_buttonEnableDTKMusic = GetDlgItem(IDC_ENABLE_DTK_MUSIC);
m_buttonAntiGap = GetDlgItem(IDC_ANTIGAP);
m_buttonDumpSamples = GetDlgItem(IDC_DUMPSAMPLES);
m_editDumpSamplePath = GetDlgItem(IDC_SAMPLEDUMPPATH);
m_comboSampleRate = GetDlgItem(IDC_SAMPLERATE);
m_buttonEnableHLEAudio.SetCheck(g_Config.m_EnableHLEAudio ? BST_CHECKED : BST_UNCHECKED);
m_buttonEnableDTKMusic.SetCheck(g_Config.m_EnableDTKMusic ? BST_CHECKED : BST_UNCHECKED);
m_buttonAntiGap.SetCheck(g_Config.m_AntiGap ? BST_CHECKED : BST_UNCHECKED);
m_buttonDumpSamples.SetCheck(g_Config.m_DumpSamples ? BST_CHECKED : BST_UNCHECKED);
m_editDumpSamplePath.SetWindowText(g_Config.m_szSamplePath.c_str());
m_comboSampleRate.AddString("44100");
m_comboSampleRate.AddString("48000");
m_comboSampleRate.SetCurSel(g_Config.m_SampleRate == 44100 ? 0 : 1);
return(TRUE);
}
LRESULT
CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (wID == IDOK)
{
g_Config.m_EnableHLEAudio = (m_buttonEnableHLEAudio.GetCheck() == BST_CHECKED) ? true : false;
g_Config.m_EnableDTKMusic = (m_buttonEnableDTKMusic.GetCheck() == BST_CHECKED) ? true : false;
g_Config.m_DumpSamples = (m_buttonDumpSamples.GetCheck() == BST_CHECKED) ? true : false;
g_Config.m_AntiGap = (m_buttonAntiGap.GetCheck() == BST_CHECKED) ? true : false;
char temp[MAX_PATH];
m_editDumpSamplePath.GetWindowText(temp, MAX_PATH);
g_Config.m_szSamplePath = temp;
g_Config.m_SampleRate = (m_comboSampleRate.GetCurSel() == 0 ? 44100 : 48000);
g_Config.Save();
}
EndDialog(wID);
g_Config.Save();
return(0);
}

View File

@ -0,0 +1,49 @@
// 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
class CConfigDlg
: public CDialogImpl<CConfigDlg>
{
public:
enum { IDD = IDD_SETTINGS };
BEGIN_MSG_MAP(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
END_MSG_MAP()
private:
CButton m_buttonEnableHLEAudio;
CButton m_buttonEnableDTKMusic;
CButton m_buttonDumpSamples;
CButton m_buttonAntiGap;
CEdit m_editDumpSamplePath;
CComboBox m_comboSampleRate;
// 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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
};

View File

@ -0,0 +1,105 @@
// 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/
#ifdef _WIN32
#include "PCHW/DSoundStream.h"
#endif
#include "DSPHandler.h"
CDSPHandler* CDSPHandler::m_pInstance = NULL;
CDSPHandler::CDSPHandler()
: m_pUCode(NULL),
m_bHalt(false),
m_bAssertInt(false)
{
SetUCode(UCODE_ROM);
m_DSPControl.DSPHalt = 1;
m_DSPControl.DSPInit = 1;
}
CDSPHandler::~CDSPHandler()
{
SAFE_DELETE(m_pUCode);
}
void CDSPHandler::Update()
{
if (m_pUCode != NULL)
{
m_pUCode->Update();
}
}
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
{
UDSPControl Temp(_Value);
if (Temp.DSPReset)
{
SetUCode(UCODE_ROM);
Temp.DSPReset = 0;
}
if (Temp.DSPInit == 0)
{
// copy 128 byte from ARAM 0x000000 to IMEM
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
Temp.DSPInitCode = 0;
// MessageBox(NULL, "UCODE_INIT_AUDIO_SYSTEM", "DSP-HLE", MB_OK);
}
m_DSPControl.Hex = Temp.Hex;
return(m_DSPControl.Hex);
}
unsigned short CDSPHandler::ReadControlRegister()
{
return(m_DSPControl.Hex);
}
void CDSPHandler::SendMailToDSP(u32 _uMail)
{
if (m_pUCode != NULL)
{
m_pUCode->HandleMail(_uMail);
}
}
IUCode* CDSPHandler::GetUCode()
{
return(m_pUCode);
}
void CDSPHandler::SetUCode(u32 _crc)
{
SAFE_DELETE(m_pUCode);
m_MailHandler.Clear();
m_pUCode = UCodeFactory(_crc, m_MailHandler);
}

View File

@ -0,0 +1,107 @@
// 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 _DSPHANDLER_H
#define _DSPHANDLER_H
#include "Common.h"
#include "MailHandler.h"
#include "UCodes/UCodes.h"
// CDSPHandler
class CDSPHandler
{
public:
void Update();
unsigned short WriteControlRegister(unsigned short _Value);
unsigned short ReadControlRegister();
void SendMailToDSP(u32 _uMail);
IUCode* GetUCode();
void SetUCode(u32 _crc);
CMailHandler& AccessMailHandler() {return(m_MailHandler);}
static CDSPHandler& GetInstance()
{
return(*m_pInstance);
}
static void Destroy()
{
SAFE_DELETE(m_pInstance);
}
static CDSPHandler& CreateInstance()
{
if (m_pInstance == NULL)
{
m_pInstance = new CDSPHandler();
}
return(*m_pInstance);
}
private:
CDSPHandler();
~CDSPHandler();
// UDSPControl
union UDSPControl
{
u16 Hex;
struct
{
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
unsigned DSPAssertInt : 1;
unsigned DSPHalt : 1;
unsigned AI : 1;
unsigned AI_mask : 1;
unsigned ARAM : 1;
unsigned ARAM_mask : 1;
unsigned DSP : 1;
unsigned DSP_mask : 1;
unsigned ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag
unsigned DSPInitCode : 1;
unsigned DSPInit : 1; // DSPInit() writes to this flag
unsigned pad : 4;
};
UDSPControl(u16 _Hex = 0)
: Hex(_Hex)
{}
};
// singleton instance
static CDSPHandler* m_pInstance;
IUCode* m_pUCode;
UDSPControl m_DSPControl;
CMailHandler m_MailHandler;
bool m_bHalt;
bool m_bAssertInt;
};
#endif

View File

@ -0,0 +1,55 @@
#include <stdarg.h>
#include <stdio.h>
#include "Common.h"
#include "Globals.h"
void DebugLog(const char* _fmt, ...)
{
#ifdef _DEBUG
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg);
#endif
}
extern u8* g_pMemory;
// TODO: Wii support?
#define RAM_MASK 0x1FFFFFF
u8 Memory_Read_U8(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return(g_pMemory[_uAddress]);
}
u16 Memory_Read_U16(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return(Common::swap16(*(u16*)&g_pMemory[_uAddress]));
}
u32 Memory_Read_U32(u32 _uAddress)
{
_uAddress &= RAM_MASK;
return(Common::swap32(*(u32*)&g_pMemory[_uAddress]));
}
float Memory_Read_Float(u32 _uAddress)
{
u32 uTemp = Memory_Read_U32(_uAddress);
return(*(float*)&uTemp);
}

View File

@ -0,0 +1,17 @@
#ifndef _GLOBALS_H
#define _GLOBALS_H
#include "Common.h"
#include "pluginspecs_dsp.h"
extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
u8 Memory_Read_U8(u32 _uAddress);
u16 Memory_Read_U16(u32 _uAddress);
u32 Memory_Read_U32(u32 _uAddress);
float Memory_Read_Float(u32 _uAddress);
#endif

View File

@ -0,0 +1,112 @@
// 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 "MailHandler.h"
CMailHandler::CMailHandler()
{}
CMailHandler::~CMailHandler()
{
Clear();
}
void CMailHandler::PushMail(u32 _Mail)
{
m_Mails.push(_Mail);
Update();
}
u16
CMailHandler::ReadDSPMailboxHigh()
{
// check if we have a mail for the core
if (!m_Mails.empty())
{
u16 result = (m_Mails.front() >> 16) & 0xFFFF;
Update();
return(result);
}
return(0x00);
}
u16
CMailHandler::ReadDSPMailboxLow()
{
// check if we have a mail for the core
if (!m_Mails.empty())
{
u16 result = m_Mails.front() & 0xFFFF;
m_Mails.pop();
Update();
return(result);
}
return(0x00);
}
void CMailHandler::Clear()
{
while (!m_Mails.empty())
{
m_Mails.pop();
}
}
bool
CMailHandler::IsEmpty()
{
return(m_Mails.empty());
}
void
CMailHandler::Halt(bool _Halt)
{
if (_Halt)
{
Clear();
m_Mails.push(0x80544348);
}
Update();
}
void
CMailHandler::Update()
{
if (!IsEmpty())
{
// g_dspInitialize.pGenerateDSPInterrupt();
}
}

View File

@ -0,0 +1,55 @@
// 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 _MAILHANDLER_H
#define _MAILHANDLER_H
#include <queue>
#include "Common.h"
class CMailHandler
{
public:
CMailHandler();
~CMailHandler();
void PushMail(u32 _Mail);
void Clear();
void Halt(bool _Halt);
bool IsEmpty();
u16 ReadDSPMailboxHigh();
u16 ReadDSPMailboxLow();
void Update();
private:
// mail handler
std::queue<u32>m_Mails;
};
#endif

View File

@ -0,0 +1,254 @@
// 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 <mmsystem.h>
#include <dsound.h>
#include "dsoundstream.h"
namespace DSound
{
#define BUFSIZE 32768
#define MAXWAIT 70 //ms
CRITICAL_SECTION soundCriticalSection;
HANDLE soundSyncEvent;
HANDLE hThread;
StreamCallback callback;
//lite mojs
IDirectSound8* ds;
IDirectSoundBuffer* dsBuffer;
//tja.. beh<65>vs
int bufferSize; //i bytes
int totalRenderedBytes;
int sampleRate;
//med den h<>r synkar vi st<73>ngning..
//0=vi spelar ov<6F>sen, 1=st<73>ng tr<74>den NU!
volatile int threadData;
inline int FIX128(int x)
{
return(x & (~127));
}
int DSound_GetSampleRate()
{
return(sampleRate);
}
bool CreateBuffer()
{
PCMWAVEFORMAT pcmwf;
DSBUFFERDESC dsbdesc;
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
memset(&dsbdesc, 0, sizeof(DSBUFFERDESC));
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
pcmwf.wf.nChannels = 2;
pcmwf.wf.nSamplesPerSec = sampleRate;
pcmwf.wf.nBlockAlign = 4;
pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
pcmwf.wBitsPerSample = 16;
//buffer description
dsbdesc.dwSize = sizeof(DSBUFFERDESC);
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_STICKYFOCUS; //VIKTIGT //DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
dsbdesc.dwBufferBytes = bufferSize = BUFSIZE;
dsbdesc.lpwfxFormat = (WAVEFORMATEX*)&pcmwf;
if (SUCCEEDED(ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL)))
{
dsBuffer->SetCurrentPosition(0);
return(true);
}
else
{
// Failed.
dsBuffer = NULL;
return(false);
}
}
bool WriteDataToBuffer(DWORD dwOffset, // Our own write cursor.
char* soundData, // Start of our data.
DWORD dwSoundBytes) // Size of block to copy.
{
void* ptr1, * ptr2;
DWORD numBytes1, numBytes2;
// Obtain memory address of write block. This will be in two parts if the block wraps around.
HRESULT hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
// If the buffer was lost, restore and retry lock.
if (DSERR_BUFFERLOST == hr)
{
dsBuffer->Restore();
hr = dsBuffer->Lock(dwOffset, dwSoundBytes, &ptr1, &numBytes1, &ptr2, &numBytes2, 0);
}
if (SUCCEEDED(hr))
{
memcpy(ptr1, soundData, numBytes1);
if (ptr2 != 0)
{
memcpy(ptr2, soundData + numBytes1, numBytes2);
}
// Release the data back to DirectSound.
dsBuffer->Unlock(ptr1, numBytes1, ptr2, numBytes2);
return(true);
}
return(false);
}
inline int ModBufferSize(int x)
{
return((x + bufferSize) % bufferSize);
}
int currentPos;
int lastPos;
short realtimeBuffer[1024 * 1024];
//Sj<53>lva tr<74>den
DWORD WINAPI soundThread(void*)
{
currentPos = 0;
lastPos = 0;
// Prefill buffer?
//writeDataToBuffer(0,realtimeBuffer,bufferSize);
// dsBuffer->Lock(0, bufferSize, (void **)&p1, &num1, (void **)&p2, &num2, 0);
dsBuffer->Play(0, 0, DSBPLAY_LOOPING);
while (!threadData)
{
// No blocking inside the csection
EnterCriticalSection(&soundCriticalSection);
dsBuffer->GetCurrentPosition((DWORD*)&currentPos, 0);
int numBytesToRender = FIX128(ModBufferSize(currentPos - lastPos));
if (numBytesToRender >= 256)
{
(*callback)(realtimeBuffer, numBytesToRender >> 2, 16, 44100, 2);
WriteDataToBuffer(lastPos, (char*)realtimeBuffer, numBytesToRender);
currentPos = ModBufferSize(lastPos + numBytesToRender);
totalRenderedBytes += numBytesToRender;
lastPos = currentPos;
}
LeaveCriticalSection(&soundCriticalSection);
WaitForSingleObject(soundSyncEvent, MAXWAIT);
}
dsBuffer->Stop();
return(0); //hurra!
}
bool DSound_StartSound(HWND window, int _sampleRate, StreamCallback _callback)
{
callback = _callback;
threadData = 0;
sampleRate = _sampleRate;
//no security attributes, automatic resetting, init state nonset, untitled
soundSyncEvent = CreateEvent(0, false, false, 0);
//vi initierar den...........
InitializeCriticalSection(&soundCriticalSection);
//vi vill ha access till DSOUND s<>...
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
{
return(false);
}
ds->SetCooperativeLevel(window, DSSCL_NORMAL);
if (!CreateBuffer())
{
return(false);
}
DWORD num1;
short* p1;
dsBuffer->Lock(0, bufferSize, (void* *)&p1, &num1, 0, 0, 0);
memset(p1, 0, num1);
dsBuffer->Unlock(p1, num1, 0, 0);
totalRenderedBytes = -bufferSize;
DWORD h;
hThread = CreateThread(0, 0, soundThread, 0, 0, &h);
SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL);
return(true);
}
void DSound_UpdateSound()
{
SetEvent(soundSyncEvent);
}
void DSound_StopSound()
{
EnterCriticalSection(&soundCriticalSection);
threadData = 1;
//kick the thread if it's waiting
SetEvent(soundSyncEvent);
LeaveCriticalSection(&soundCriticalSection);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
dsBuffer->Release();
ds->Release();
CloseHandle(soundSyncEvent);
}
int DSound_GetCurSample()
{
EnterCriticalSection(&soundCriticalSection);
int playCursor;
dsBuffer->GetCurrentPosition((DWORD*)&playCursor, 0);
playCursor = ModBufferSize(playCursor - lastPos) + totalRenderedBytes;
LeaveCriticalSection(&soundCriticalSection);
return(playCursor);
}
float DSound_GetTimer()
{
return((float)DSound_GetCurSample() * (1.0f / (4.0f * 44100.0f)));
}
}

View File

@ -0,0 +1,35 @@
// 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 __SOUNDSTREAM_H__
#define __SOUNDSTREAM_H__
namespace DSound
{
typedef void (*StreamCallback)(short* buffer, int numSamples, int bits, int rate, int channels);
bool DSound_StartSound(HWND window, int sampleRate, StreamCallback _callback);
void DSound_UpdateSound();
void DSound_StopSound();
float DSound_GetTimer();
int DSound_GetCurSample();
int DSound_GetSampleRate();
}
#endif //__SOUNDSTREAM_H__

View File

@ -0,0 +1,48 @@
// 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 "../Config.h"
#include "../Globals.h"
#include "../DSPHandler.h"
#include "Mixer.h"
volatile bool mixer_HLEready = false;
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels)
{
// silence
memset(buffer, 0, numSamples * 2 * sizeof(short));
// first get th DTK Music
if (g_Config.m_EnableDTKMusic)
{
g_dspInitialize.pGetAudioStreaming(buffer, numSamples);
}
//if this was called directly from the HLE, and not by timeout
if (g_Config.m_EnableHLEAudio && (mixer_HLEready || g_Config.m_AntiGap))
{
IUCode* pUCode = CDSPHandler::GetInstance().GetUCode();
if (pUCode != NULL)
{
pUCode->MixAdd(buffer, numSamples);
}
}
}

View File

@ -0,0 +1,26 @@
// 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 _MIXER_H
#define _MIXER_H
extern volatile bool mixer_HLEready;
void Mixer(short* buffer, int numSamples, int bits, int rate, int channels);
#endif

View File

@ -0,0 +1,17 @@
Import('env')
files = ["DSPHandler.cpp",
"MailHandler.cpp",
"main.cpp",
"Config.cpp",
"Globals.cpp",
"PCHW/Mixer.cpp",
"UCodes/UCode_AX.cpp",
"UCodes/UCode_CARD.cpp",
"UCodes/UCode_InitAudioSystem.cpp",
"UCodes/UCode_Jac.cpp",
"UCodes/UCode_ROM.cpp",
"UCodes/UCodes.cpp",
"UCodes/UCode_Zelda.cpp",
]
env.SharedLibrary("../../../../Binary/linux/Plugins/dsphle.so", files, LIBS = ["common"])

View File

@ -0,0 +1,244 @@
// 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 "Common.h"
#include "../Globals.h"
#ifdef _WIN32
#include "../PCHW/DSoundStream.h"
#endif
#include "../PCHW/Mixer.h"
#include "../MailHandler.h"
#include "UCodes.h"
#include "UCode_AX.h"
CUCode_AX::CUCode_AX(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
{
// we got loaded
m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(0x80000000); // handshake ??? only (crc == 0xe2136399) needs it ...
}
CUCode_AX::~CUCode_AX()
{
m_rMailHandler.Clear();
}
void CUCode_AX::HandleMail(u32 _uMail)
{
if ((_uMail & 0xFFFF0000) == 0xBABE0000)
{
// a new List
}
else
{
AXTask(_uMail);
}
}
void
CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
{}
void CUCode_AX::Update()
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}
}
bool CUCode_AX::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress);
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
u32 Addr__AXOutSBuffer_1;
u32 Addr__AXOutSBuffer_2;
u32 Addr__A;
u32 Addr__12;
u32 Addr__4_1;
u32 Addr__4_2;
u32 Addr__5_1;
u32 Addr__5_2;
u32 Addr__6;
u32 Addr__9;
bool bExecuteList = true;
while (bExecuteList)
{
u16 iCommand = Memory_Read_U16(uAddress);
uAddress += 2;
switch (iCommand)
{
case 0x00: //00
Addr__AXStudio = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST studio address: %08x", Addr__AXStudio);
break;
case 0x001:
{
u32 address = Memory_Read_U32(uAddress);
uAddress += 4;
u16 param1 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param2 = Memory_Read_U16(uAddress);
uAddress += 2;
u16 param3 = Memory_Read_U16(uAddress);
uAddress += 2;
DebugLog("AXLIST 1: %08x, %04x, %04x, %04x", address, param1, param2, param3);
}
break;
case 0x02: //02
{
uAddress += 4;
#ifdef _WIN32
DebugLog("Update the SoundThread to be in sync");
DSound::DSound_UpdateSound(); //do it in this thread to avoid sync problems
#endif
}
break;
case 0x0003: // ????
DebugLog("AXLIST command 0x0003 ????");
break;
case 0x0004:
Addr__4_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__4_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 4_1 4_2 addresses: %08x %08x", Addr__4_1, Addr__4_2);
break;
case 0x0005:
Addr__5_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__5_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 5_1 5_2 addresses: %08x %08x", Addr__5_1, Addr__5_2);
break;
case 0x0006:
Addr__6 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__6);
break;
case 0x07:
Addr__AXOutSBuffer = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST OutSBuffer address: %08x", Addr__AXOutSBuffer);
break;
case 0x0009:
Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__9);
break;
case 0x0a:
Addr__A = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST CompressorTable address: %08x", Addr__A);
break;
case 0x000e:
Addr__AXOutSBuffer_1 = Memory_Read_U32(uAddress);
uAddress += 4;
Addr__AXOutSBuffer_2 = Memory_Read_U32(uAddress);
uAddress += 4;
DebugLog("AXLIST sbuf2 addresses: %08x %08x", Addr__AXOutSBuffer_1, Addr__AXOutSBuffer_2);
break;
case 0x0f:
bExecuteList = false;
DebugLog("AXLIST end");
break;
case 0x0010: //monkey ball2
DebugLog("AXLIST unknown");
//should probably read/skip stuff here
uAddress += 8;
break;
case 0x0011:
uAddress += 4;
break;
case 0x0012:
Addr__12 = Memory_Read_U16(uAddress);
uAddress += 2;
break;
case 0x0013:
uAddress += 6 * 4; // 6 Addresses
break;
default:
{
static bool bFirst = true;
if (bFirst == true)
{
char szTemp[2048];
sprintf(szTemp, "Unknown AX-Command 0x%x (address: 0x%08x)\n", iCommand, uAddress - 2);
int num = 0;
while (num < 64)
{
char szTemp2[128] = "";
sprintf(szTemp2, "0x%04x\n", Memory_Read_U16(uAddress + num));
strcat(szTemp, szTemp2);
num += 2;
}
PanicAlert(szTemp);
bFirst = false;
}
// unknown command so stop the execution of this TaskList
bExecuteList = false;
}
break;
}
}
DebugLog("AXTask - done, send resume");
// i hope resume is okay AX
m_rMailHandler.PushMail(0xDCD10001);
return(true);
}

View File

@ -0,0 +1,48 @@
// 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
class CUCode_AX
: public IUCode
{
public:
// constructor
CUCode_AX(CMailHandler& _rMailHandler);
// destructor
virtual ~CUCode_AX();
// HandleMail
void HandleMail(u32 _uMail);
// Mix Add
void MixAdd(short* _pBuffer, int _iSize);
// Update
void Update();
private:
// ax task message handler
bool AXTask(u32& _uMail);
// SendMail
void SendMail(u32 _uMail);
};

View File

@ -0,0 +1,70 @@
// 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 "Common.h"
#include "../Globals.h"
#include "../DSPHandler.h"
#include "UCodes.h"
#include "UCode_CARD.h"
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
{
DebugLog("CUCode_CARD - initialized");
m_rMailHandler.PushMail(DSP_INIT);
}
CUCode_CARD::~CUCode_CARD()
{
m_rMailHandler.Clear();
}
void
CUCode_CARD::Update()
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}
}
// ==================================================================================================
// Mail handler
// ==================================================================================================
void
CUCode_CARD::HandleMail(u32 _uMail)
{
if (_uMail == 0xFF000000) // unlock card
{
// m_Mails.push(0x00000001); // ACK (actualy anything != 0)
}
else
{
DebugLog("CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
}
m_rMailHandler.PushMail(DSP_DONE);
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
}

View File

@ -0,0 +1,55 @@
// 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 _UCODE_CARD_H
#define _UCODE_CARD_H
#include "UCodes.h"
class CUCode_CARD
: public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
public:
// constructor
CUCode_CARD(CMailHandler& _rMailHandler);
// destructor
virtual ~CUCode_CARD();
// handle mail
void HandleMail(u32 _uMail);
// update
void Update();
};
#endif

View File

@ -0,0 +1,55 @@
// 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 "Common.h"
#include "../Globals.h"
#include "../DSPHandler.h"
#include "UCodes.h"
#include "UCode_InitAudioSystem.h"
CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_BootTask_numSteps(0)
, m_NextParameter(0)
, IsInitialized(false)
{
DebugLog("CUCode_InitAudioSystem - initialized");
}
CUCode_InitAudioSystem::~CUCode_InitAudioSystem()
{}
void CUCode_InitAudioSystem::Init()
{}
void CUCode_InitAudioSystem::Update()
{
if (m_rMailHandler.IsEmpty())
{
m_rMailHandler.PushMail(0x80544348);
// HALT
}
}
void CUCode_InitAudioSystem::HandleMail(u32 _uMail)
{}

View File

@ -0,0 +1,58 @@
// 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 _UCODE_INITAUDIOSYSTEM
#define _UCODE_INITAUDIOSYSTEM
#include "UCodes.h"
class CUCode_InitAudioSystem
: public IUCode
{
public:
CUCode_InitAudioSystem(CMailHandler& _rMailHandler);
virtual ~CUCode_InitAudioSystem();
void HandleMail(u32 _uMail);
void Update();
void Init();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
bool IsInitialized;
void BootUCode();
};
#endif

View File

@ -0,0 +1,162 @@
// 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 "Common.h"
#include "../Globals.h"
#include "UCodes.h"
#include "UCode_Jac.h"
#include "../MailHandler.h"
CUCode_Jac::CUCode_Jac(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_bListInProgress(false)
{
DebugLog("CUCode_Jac: init");
m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(0x80000000);
}
CUCode_Jac::~CUCode_Jac()
{
m_rMailHandler.Clear();
}
void CUCode_Jac::HandleMail(u32 _uMail)
{
// this is prolly totally bullshit and should work like the zelda one...
// but i am to lazy to change it atm
if (m_bListInProgress == false)
{
// get the command to find out how much steps it has
switch (_uMail & 0xFFFF)
{
// release halt
case 0x00:
// m_Mails.push(0x80000000);
g_dspInitialize.pGenerateDSPInterrupt();
break;
case 0x40:
m_step = 0;
((u32*)m_Buffer)[m_step++] = _uMail;
m_bListInProgress = true;
m_numSteps = 5;
break;
case 0x2000:
case 0x4000:
m_step = 0;
((u32*)m_Buffer)[m_step++] = _uMail;
m_bListInProgress = true;
m_numSteps = 3;
break;
default:
PanicAlert("UCode Jac");
DebugLog("UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
break;
}
}
else
{
((u32*)m_Buffer)[m_step] = _uMail;
m_step++;
if (m_step == m_numSteps)
{
ExecuteList();
m_bListInProgress = false;
}
}
}
void CUCode_Jac::Update()
{
// check if we have to sent something
/* if (!g_MailHandler.empty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}*/
}
void CUCode_Jac::ExecuteList()
{
// begin with the list
m_readOffset = 0;
u16 cmd = Read16();
u16 sync = Read16();
DebugLog("==============================================================================");
DebugLog("UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
switch (cmd)
{
// ==============================================================================
// DsetupTable
// ==============================================================================
case 0x40:
{
u32 tmp[4];
tmp[0] = Read32();
tmp[1] = Read32();
tmp[2] = Read32();
tmp[3] = Read32();
DebugLog("DsetupTable");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]);
}
break;
// ==============================================================================
// UpdateDSPChannel
// ==============================================================================
case 0x2000:
case 0x4000: // animal crossing
{
u32 tmp[3];
tmp[0] = Read32();
tmp[1] = Read32();
tmp[2] = Read32();
DebugLog("UpdateDSPChannel");
DebugLog("audiomemory: 0x%08x", tmp[0]);
DebugLog("audiomemory: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
}
break;
default:
PanicAlert("UCode Jac unknown cmd: %s (size %)", cmd, m_numSteps);
DebugLog("Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
break;
}
// sync, we are rdy
m_rMailHandler.PushMail(DSP_SYNC);
m_rMailHandler.PushMail(0xF3550000 | sync);
}

View File

@ -0,0 +1,85 @@
// 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 _UCODE_JAC
#define _UCODE_JAC
#include "UCodes.h"
class CUCode_Jac
: public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progre
bool m_bListInProgress;
int m_numSteps;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
// constructor
CUCode_Jac(CMailHandler& _rMailHandler);
// destructor
virtual ~CUCode_Jac();
// handleMail
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -0,0 +1,117 @@
// 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 "Common.h"
#include "../Globals.h"
#include "../DSPHandler.h"
#include "UCodes.h"
#include "UCode_ROM.h"
CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_BootTask_numSteps(0)
, m_NextParameter(0)
{
DebugLog("UCode_Rom - initialized");
m_rMailHandler.Clear();
m_rMailHandler.PushMail(0x8071FEED);
}
CUCode_Rom::~CUCode_Rom()
{}
void CUCode_Rom::Update()
{}
void CUCode_Rom::HandleMail(u32 _uMail)
{
if (m_NextParameter == 0)
{
// wait for beginning of UCode
if ((_uMail & 0xFFFF0000) != 0x80F30000)
{
u32 Message = 0xFEEE0000 | (_uMail & 0xFFFF);
m_rMailHandler.PushMail(Message);
}
else
{
m_NextParameter = _uMail;
}
}
else
{
switch (m_NextParameter)
{
case 0x80F3A001:
m_CurrentUCode.m_RAMAddress = _uMail;
break;
case 0x80F3A002:
m_CurrentUCode.m_Length = _uMail;
break;
case 0x80F3C002:
m_CurrentUCode.m_IMEMAddress = _uMail;
break;
case 0x80F3B002:
m_CurrentUCode.m_Unk = _uMail;
break;
case 0x80F3D001:
{
m_CurrentUCode.m_StartPC = _uMail;
BootUCode();
}
break;
}
m_NextParameter = 0;
}
}
void
CUCode_Rom::BootUCode()
{
// simple non-scientific crc invented by ector :P
// too annoying to change now, and probably good enough anyway
u32 crc = 0;
for (u32 i = 0; i < m_CurrentUCode.m_Length; i++)
{
crc ^= Memory_Read_U8(m_CurrentUCode.m_RAMAddress + i);
//let's rol
crc = (crc << 3) | (crc >> 29);
}
DebugLog("CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
DebugLog("CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
DebugLog("CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
DebugLog("CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
DebugLog("CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
DebugLog("CurrentUCode CRC: 0x%08x", crc);
DebugLog("BootTask - done");
CDSPHandler::GetInstance().SetUCode(crc);
}

View File

@ -0,0 +1,55 @@
// 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 _UCODE_ROM
#define _UCODE_ROM
#include "UCodes.h"
class CUCode_Rom
: public IUCode
{
public:
CUCode_Rom(CMailHandler& _rMailHandler);
virtual ~CUCode_Rom();
void HandleMail(u32 _uMail);
void Update();
private:
struct SUCode
{
u32 m_RAMAddress;
u32 m_Length;
u32 m_IMEMAddress;
u32 m_Unk;
u32 m_StartPC;
};
SUCode m_CurrentUCode;
int m_BootTask_numSteps;
u32 m_NextParameter;
void BootUCode();
};
#endif

View File

@ -0,0 +1,171 @@
// 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/
// Games that uses this UCode:
// Zelda: The Windwalker, Mario Sunshine, Mario Kart
#include "Common.h"
#include "../Globals.h"
#include "UCodes.h"
#include "UCode_Zelda.h"
#include "../MailHandler.h"
CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler)
, m_numSteps(0)
, m_bListInProgress(false)
{
DebugLog("UCode_Zelda - add boot mails for handshake");
m_rMailHandler.PushMail(DSP_INIT);
m_rMailHandler.PushMail(0x80000000); // handshake
}
CUCode_Zelda::~CUCode_Zelda()
{
m_rMailHandler.Clear();
}
void
CUCode_Zelda::Update()
{
// check if we have to sent something
if (!m_rMailHandler.IsEmpty())
{
g_dspInitialize.pGenerateDSPInterrupt();
}
}
// ==================================================================================================
// Mail handler
// ==================================================================================================
void
CUCode_Zelda::HandleMail(u32 _uMail)
{
if (m_bListInProgress == false)
{
m_bListInProgress = true;
m_numSteps = _uMail;
m_step = 0;
}
else
{
((u32*)m_Buffer)[m_step] = _uMail;
m_step++;
if (m_step == m_numSteps)
{
ExecuteList();
m_bListInProgress = false;
}
}
}
void
CUCode_Zelda::ExecuteList()
{
// begin with the list
m_readOffset = 0;
u32 Temp = Read32();
u32 Command = (Temp >> 24) & 0x7f;
u32 Sync = Temp >> 16;
DebugLog("==============================================================================");
DebugLog("Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
switch (Command)
{
// DsetupTable ... zelda ww jumps to 0x0095
case 0x01:
{
u32 tmp[4];
tmp[0] = Read32();
tmp[1] = Read32();
tmp[2] = Read32();
tmp[3] = Read32();
DebugLog("DsetupTable");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]);
}
break;
// SyncFrame ... zelda ww jumps to 0x0243
case 0x02:
{
u32 tmp[3];
tmp[0] = Read32();
tmp[1] = Read32();
tmp[2] = Read32();
DebugLog("DsyncFrame");
DebugLog("???: 0x%08x", tmp[0]);
DebugLog("???: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
}
break;
/*
case 0x03: break; // dunno ... zelda ww jmps to 0x0073
case 0x04: break; // dunno ... zelda ww jmps to 0x0580
case 0x05: break; // dunno ... zelda ww jmps to 0x0592
case 0x06: break; // dunno ... zelda ww jmps to 0x0469
case 0x07: break; // dunno ... zelda ww jmps to 0x044d
case 0x08: break; // Mixer ... zelda ww jmps to 0x0485
case 0x09: break; // dunno ... zelda ww jmps to 0x044d
*/
// DsetDolbyDelay ... zelda ww jumps to 0x00b2
case 0x0d:
{
u32 tmp[2];
tmp[0] = Read32();
tmp[1] = Read32();
DebugLog("DSetDolbyDelay");
DebugLog("DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
}
break;
// Set VARAM
case 0x0e:
// MessageBox(NULL, "Zelda VARAM", "cmd", MB_OK);
break;
// default ... zelda ww jumps to 0x0043
default:
PanicAlert("Zelda UCode - unknown cmd: %x (size %i)", Command, m_numSteps);
break;
}
// sync, we are rdy
m_rMailHandler.PushMail(DSP_SYNC);
m_rMailHandler.PushMail(0xF3550000 | Sync);
}

View File

@ -0,0 +1,81 @@
// 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 _UCODE_ZELDA_H
#define _UCODE_ZELDA_H
#include "Common.h"
#include "UCodes.h"
class CUCode_Zelda
: public IUCode
{
private:
enum EDSP_Codes
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,
DSP_YIELD = 0xDCD10002,
DSP_DONE = 0xDCD10003,
DSP_SYNC = 0xDCD10004,
DSP_UNKN = 0xDCD10005,
};
// List in progress
int m_numSteps;
bool m_bListInProgress;
int m_step;
u8 m_Buffer[1024];
void ExecuteList();
u32 m_readOffset;
u8 Read8()
{
return(m_Buffer[m_readOffset++]);
}
u16 Read16()
{
u16 res = *(u16*)&m_Buffer[m_readOffset];
m_readOffset += 2;
return(res);
}
u32 Read32()
{
u32 res = *(u32*)&m_Buffer[m_readOffset];
m_readOffset += 4;
return(res);
}
public:
CUCode_Zelda(CMailHandler& _rMailHandler);
virtual ~CUCode_Zelda();
void HandleMail(u32 _uMail);
void Update();
};
#endif

View File

@ -0,0 +1,87 @@
// 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 "Common.h"
#include "../Globals.h"
#include "UCodes.h"
#include "UCode_AX.h"
#include "UCode_Zelda.h"
#include "UCode_Jac.h"
#include "UCode_ROM.h"
#include "UCode_CARD.h"
#include "UCode_InitAudioSystem.h"
IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
{
switch (_CRC)
{
case UCODE_ROM:
return(new CUCode_Rom(_rMailHandler));
case UCODE_INIT_AUDIO_SYSTEM:
return(new CUCode_InitAudioSystem(_rMailHandler));
case 0x65d6cc6f: // CARD
return(new CUCode_CARD(_rMailHandler));
case 0x088e38a5: // IPL - JAP
case 0xd73338cf: // IPL
case 0x42f64ac4: // Luigi (after fix)
case 0x4be6a5cb: // AC, Pikmin (after fix)
DebugLog("JAC ucode chosen");
return(new CUCode_Jac(_rMailHandler));
case 0x3ad3b7ac: // Naruto3
case 0x3daf59b9: // Alien Hominid
case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball2,cubivore,puzzlecollection,wario,
// capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
// smugglers run warzone, smash brothers, sonic mega collection, ZooCube
// nddemo, starfox
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
// Zelda:OOT, Tony hawk, viewtiful joe
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
DebugLog("AX ucode chosen, yay!");
return(new CUCode_AX(_rMailHandler));
case 0x6CA33A6D: // DK Jungle Beat
case 0x86840740: // zelda
case 0x56d36052: // mario
case 0x2fcdf1ec: // mariokart, zelda 4 swords
DebugLog("Zelda ucode chosen");
return(new CUCode_Zelda(_rMailHandler));
// WII CRCs
case 0x6c3f6f94: // zelda - PAL
case 0xd643001f: // mario galaxy - PAL
DebugLog("Zelda Wii ucode chosen");
return(new CUCode_Zelda(_rMailHandler));
case 0x347112ba: // raving rabbits
DebugLog("Wii - AX chosen");
return(new CUCode_AX(_rMailHandler));
default:
PanicAlert("Unknown ucode (CRC = %08x) - forcing AX", _CRC);
return(new CUCode_AX(_rMailHandler));
}
return(NULL);
}

View File

@ -0,0 +1,56 @@
// 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 _UCODES_H
#define _UCODES_H
#include "Common.h"
#define UCODE_ROM 0x0000000
#define UCODE_INIT_AUDIO_SYSTEM 0x0000001
class CMailHandler;
class IUCode
{
public:
IUCode(CMailHandler& _rMailHandler)
: m_rMailHandler(_rMailHandler)
{}
virtual ~IUCode()
{}
virtual void HandleMail(u32 _uMail) = 0;
virtual void Update(void) = 0;
virtual void MixAdd(short* buffer, int size) {}
protected:
CMailHandler& m_rMailHandler;
};
extern IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler);
#endif

View File

@ -0,0 +1,235 @@
// 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 "Common.h"
#include "Globals.h"
#include "resource.h"
#ifdef _WIN32
#include "PCHW/DSoundStream.h"
#include "AboutDlg.h"
#include "ConfigDlg.h"
#else
// TODO
#endif
#include "PCHW/Mixer.h"
#include "DSPHandler.h"
#include "Config.h"
DSPInitialize g_dspInitialize;
u8* g_pMemory;
#ifdef _WIN32
HINSTANCE g_hInstance = NULL;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}
g_hInstance = hinstDLL;
return(TRUE);
}
#endif
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin");
#else
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin Debug");
#endif
}
void DllAbout(HWND _hParent)
{
#ifdef _WIN32
CAboutDlg aboutDlg;
aboutDlg.DoModal(_hParent);
#endif
}
void DllConfig(HWND _hParent)
{
#ifdef _WIN32
CConfigDlg configDlg;
configDlg.DoModal(_hParent);
#endif
}
void DSP_Initialize(DSPInitialize _dspInitialize)
{
g_Config.LoadDefaults();
g_Config.Load();
g_dspInitialize = _dspInitialize;
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
CDSPHandler::CreateInstance();
#ifdef _WIN32
DSound::DSound_StartSound((HWND)g_dspInitialize.hWnd, g_Config.m_SampleRate, Mixer);
#endif
}
void DSP_Shutdown()
{
// delete the UCodes
#ifdef _WIN32
DSound::DSound_StopSound();
#endif
CDSPHandler::Destroy();
}
struct DSPState
{
u32 CPUMailbox;
bool CPUMailbox_Written[2];
u32 DSPMailbox;
bool DSPMailbox_Read[2];
DSPState()
{
CPUMailbox = 0x00000000;
CPUMailbox_Written[0] = false;
CPUMailbox_Written[1] = false;
DSPMailbox = 0x00000000;
DSPMailbox_Read[0] = true;
DSPMailbox_Read[1] = true;
}
};
DSPState g_dspState;
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return((g_dspState.CPUMailbox >> 16) & 0xFFFF);
}
else
{
return(CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh());
}
}
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return(g_dspState.CPUMailbox & 0xFFFF);
}
else
{
return(CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow());
}
}
void Update_DSP_WriteRegister()
{
// check if the whole message is complete and if we can send it
if (g_dspState.CPUMailbox_Written[0] && g_dspState.CPUMailbox_Written[1])
{
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
g_dspState.CPUMailbox_Written[0] = g_dspState.CPUMailbox_Written[1] = false;
g_dspState.CPUMailbox = 0; // Mail sent so clear it to show that it is progressed
}
}
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value)
{
if (_CPUMailbox)
{
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
g_dspState.CPUMailbox_Written[0] = true;
Update_DSP_WriteRegister();
}
else
{
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
}
}
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value)
{
if (_CPUMailbox)
{
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
g_dspState.CPUMailbox_Written[1] = true;
Update_DSP_WriteRegister();
}
else
{
PanicAlert("CPU cant write %08x to DSP mailbox", _Value);
}
}
unsigned short DSP_WriteControlRegister(unsigned short _Value)
{
return(CDSPHandler::GetInstance().WriteControlRegister(_Value));
}
unsigned short DSP_ReadControlRegister()
{
return(CDSPHandler::GetInstance().ReadControlRegister());
}
void DSP_Update()
{
CDSPHandler::GetInstance().Update();
}
void DSP_SendAIBuffer(unsigned int _Address, unsigned int _Size)
{}

View File

@ -0,0 +1,32 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Plugin_DSP.rc
//
#define IDD_SETTINGS 101
#define IDD_DIALOG2 102
#define IDD_ABOUT 102
#define IDC_COMBO1 1001
#define IDC_SAMPLERATE 1001
#define IDC_EDIT1 1002
#define IDC_SAMPLEDUMPPATH 1002
#define IDC_CHECK1 1003
#define IDC_ENABLE_AUDIO 1003
#define IDC_ENABLE_HLE_AUDIO 1003
#define IDC_CHECK2 1004
#define IDC_ENABLE_DTK_MUSIC 1004
#define IDC_DUMPSAMPLES 1005
#define IDC_SAMPLEMINLENGTH 1006
#define IDC_BROWSE 1007
#define IDC_ANTIGAP 1009
#define IDC_CHECK3 1010
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,145 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_SETTINGS DIALOGEX 0, 0, 241, 206
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Dolphin DSP-HLE Plugin 0.1 Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,185,50,14
PUSHBUTTON "Cancel",IDCANCEL,184,185,50,14
GROUPBOX "&Sound settings",IDC_STATIC,7,7,227,45
EDITTEXT IDC_SAMPLEDUMPPATH,13,158,155,13,ES_AUTOHSCROLL |
WS_DISABLED
CONTROL "&Enable HLE Audio",IDC_ENABLE_HLE_AUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,22,84,8
GROUPBOX "Sample d&umping",IDC_STATIC,7,128,227,51
CONTROL "Enab&le DTK Music",IDC_ENABLE_DTK_MUSIC,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,13,36,102,8
CONTROL "&Dump all samples longer than",IDC_DUMPSAMPLES,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,13,142,105,9
EDITTEXT IDC_SAMPLEMINLENGTH,122,140,47,12,ES_AUTOHSCROLL |
WS_DISABLED
LTEXT "seconds to:",IDC_STATIC,173,142,40,10
PUSHBUTTON "&Browse...",IDC_BROWSE,173,158,54,14
GROUPBOX "&Audio quality",IDC_STATIC,7,55,227,70
LTEXT "Sample &rate:",IDC_STATIC,13,71,67,9
COMBOBOX IDC_SAMPLERATE,81,69,65,13,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
LTEXT "48000hz recommended, if it doesn't work use 44100, it will slow down some music. Changing this during a game will have no effect.",
IDC_STATIC,81,84,146,32
CONTROL "&Anti-gap (dangerous!)",IDC_ANTIGAP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,122,22,96,9
CONTROL "&Reverb",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
WS_DISABLED | WS_TABSTOP,122,36,89,10
END
IDD_ABOUT DIALOGEX 0, 0, 184, 65
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "About Dolphin DSP-HLE Plugin 0.1"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,127,44,50,14
LTEXT "Coded by ector and F|RES",IDC_STATIC,51,25,104,14
LTEXT "Dolphin DSP-HLE plugin",IDC_STATIC,51,7,104,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_SETTINGS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 234
VERTGUIDE, 13
VERTGUIDE, 122
VERTGUIDE, 168
TOPMARGIN, 7
BOTTOMMARGIN, 199
HORZGUIDE, 31
END
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 177
TOPMARGIN, 7
BOTTOMMARGIN, 58
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,19 @@
// 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"

View File

@ -0,0 +1,35 @@
// 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
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
// Windows Header Files:
#include <windows.h>
#include <tchar.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atldlgs.h>
#include <atlctrls.h>
#endif

View File

@ -0,0 +1,749 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Plugin_PadDX9"
ProjectGUID="{805B34AA-82A5-4875-8DC7-3C85BDC0BCEE}"
RootNamespace="Plugin_PadDX9"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadDX9.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_DirectX9.pdb"
ImportLibrary=".\Release/Pad_DirectX9.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Release/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadDX9.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_DirectX9.pdb"
ImportLibrary=".\Release/Pad_DirectX9.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadDX9D.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Pad_DirectX9.pdb"
ImportLibrary=".\Debug/Pad_DirectX9.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Debug/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadDX9D.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Pad_DirectX9.pdb"
ImportLibrary=".\Debug/Pad_DirectX9.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadDX9.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_DirectX9.pdb"
ImportLibrary=".\Release/Pad_DirectX9.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Release/Pad_DirectX9.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_DIRECTX9_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
FloatingPointModel="2"
UsePrecompiledHeader="1"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadDX9.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_DirectX9.pdb"
ImportLibrary=".\Release/Pad_DirectX9.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="AboutDialog"
>
<File
RelativePath=".\Src\AboutDlg.cpp"
>
</File>
<File
RelativePath=".\Src\AboutDlg.h"
>
</File>
</Filter>
<Filter
Name="ConfigDialog"
>
<File
RelativePath=".\Src\ConfigDlg.cpp"
>
</File>
<File
RelativePath=".\Src\ConfigDlg.h"
>
</File>
</Filter>
<Filter
Name="IniFile"
>
<File
RelativePath=".\Src\IniFile.cpp"
>
</File>
<File
RelativePath=".\Src\IniFile.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
>
<File
RelativePath=".\Src\resource.h"
>
</File>
<File
RelativePath=".\Src\resource.rc"
>
</File>
</Filter>
<File
RelativePath=".\Src\DIHandler.cpp"
>
</File>
<File
RelativePath=".\Src\DIHandler.h"
>
</File>
<File
RelativePath=".\Src\main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_DIRECTX9_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\multidi.cpp"
>
</File>
<File
RelativePath=".\Src\multidi.h"
>
</File>
<File
RelativePath="..\Plugin_Specs\pad.h"
>
</File>
<File
RelativePath=".\Src\stdafx.cpp"
>
</File>
<File
RelativePath=".\Src\stdafx.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,48 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "AboutDlg.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N //////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// __________________________________________________________________________________________________
// OnInitDialog
//
LRESULT
CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(GetParent());
return TRUE;
}
// __________________________________________________________________________________________________
// OnCloseCmd
//
LRESULT
CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}

View File

@ -0,0 +1,42 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
class CAboutDlg : public CDialogImpl<CAboutDlg>
{
public:
enum { IDD = IDD_ABOUTPAD };
BEGIN_MSG_MAP(CAboutDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};

View File

@ -0,0 +1,47 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "ConfigDlg.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N //////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// __________________________________________________________________________________________________
// OnInitDialog
//
LRESULT
CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
return TRUE;
}
// __________________________________________________________________________________________________
// OnCloseCmd
//
LRESULT
CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}

View File

@ -0,0 +1,42 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
class CConfigDlg : public CDialogImpl<CConfigDlg>
{
public:
enum { IDD = IDD_PADCONFIG };
BEGIN_MSG_MAP(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
END_MSG_MAP()
private:
// 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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};

View File

@ -0,0 +1,484 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <math.h>
#include "PluginSpecs_Pad.h"
#include "multidi.h"
#include "DIHandler.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// T Y P E D E F S / D E F I N E S //////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Actions used by this app
DIACTION CDIHandler::m_rgGameAction[] =
{
// Keyboard input mappings
{ CDIHandler::INPUT_MAIN_LEFT, DIKEYBOARD_LEFT, 0, TEXT("Main left"), },
{ CDIHandler::INPUT_MAIN_RIGHT, DIKEYBOARD_RIGHT, 0, TEXT("Main right"), },
{ CDIHandler::INPUT_MAIN_UP, DIKEYBOARD_UP, 0, TEXT("Main up"), },
{ CDIHandler::INPUT_MAIN_DOWN, DIKEYBOARD_DOWN, 0, TEXT("Main down"), },
{ CDIHandler::INPUT_CPAD_LEFT, DIKEYBOARD_J, 0, TEXT("CPad left"), },
{ CDIHandler::INPUT_CPAD_RIGHT, DIKEYBOARD_L, 0, TEXT("CPad right"), },
{ CDIHandler::INPUT_CPAD_UP, DIKEYBOARD_I, 0, TEXT("CPad up"), },
{ CDIHandler::INPUT_CPAD_DOWN, DIKEYBOARD_K, 0, TEXT("CPad down"), },
{ CDIHandler::INPUT_DPAD_LEFT, DIKEYBOARD_F, 0, TEXT("DPad left"), },
{ CDIHandler::INPUT_DPAD_RIGHT, DIKEYBOARD_H, 0, TEXT("DPad right"), },
{ CDIHandler::INPUT_DPAD_UP, DIKEYBOARD_T, 0, TEXT("DPad up"), },
{ CDIHandler::INPUT_DPAD_DOWN, DIKEYBOARD_G, 0, TEXT("DPad down"), },
{ CDIHandler::INPUT_BUTTON_START, DIKEYBOARD_RETURN, 0, TEXT("Start"), },
{ CDIHandler::INPUT_BUTTON_A, DIKEYBOARD_X, 0, TEXT("A-Button"), },
{ CDIHandler::INPUT_BUTTON_B, DIKEYBOARD_Y, 0, TEXT("B-Button"), },
{ CDIHandler::INPUT_BUTTON_X, DIKEYBOARD_S, 0, TEXT("X-Button"), },
{ CDIHandler::INPUT_BUTTON_Y, DIKEYBOARD_C, 0, TEXT("Y-Button"), },
{ CDIHandler::INPUT_BUTTON_Z, DIKEYBOARD_D, 0, TEXT("Z-Button"), },
{ CDIHandler::INPUT_BUTTON_L, DIKEYBOARD_Q, 0, TEXT("L-Trigger"), },
{ CDIHandler::INPUT_BUTTON_R, DIKEYBOARD_W, 0, TEXT("R-Trigger"), },
// Joystick input mappings
{ CDIHandler::INPUT_MAIN_AXIS_LR, DIAXIS_ARCADEP_LATERAL, 0, _T("Main left/right"), },
{ CDIHandler::INPUT_MAIN_AXIS_UD, DIAXIS_ARCADEP_MOVE, 0, _T("Main Up/Down"), },
{ CDIHandler::INPUT_CPAD_AXIS_LR, DIAXIS_ANY_1, 0, _T("CPad left/right"), },
{ CDIHandler::INPUT_CPAD_AXIS_UP, DIAXIS_ANY_2, 0, _T("CPad Up/Down"), },
{ CDIHandler::INPUT_DPAD_AXIS_LR, DIPOV_ANY_1, 0, _T("DPad left/right"), },
{ CDIHandler::INPUT_DPAD_AXIS_UP, DIPOV_ANY_2, 0, _T("DPad Up/Down"), },
};
const GUID g_guidApp = { 0x3afabad0, 0xd2c0, 0x4514, { 0xb4, 0x7e, 0x65, 0xfe, 0xf9, 0xb5, 0x14, 0x2e } };
#define SAMPLE_KEY TEXT("Emulator\\Dolphin\\PadPlugin2")
#define NUMBER_OF_GAMEACTIONS (sizeof(m_rgGameAction)/sizeof(DIACTION))
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N ////////////////////////// ////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// ________________________________________________________________________________________ __________
// constructor
//
CDIHandler::CDIHandler(void) :
m_hWnd(NULL),
m_pInputDeviceManager(NULL)
{
}
// ________________________________________________________________________________________ __________
// destructor
//
CDIHandler::~CDIHandler(void)
{
CleanupDirectInput();
}
// ________________________________________________________________________________________ __________
// InitInput
//
HRESULT
CDIHandler::InitInput(HWND _hWnd)
{
if (m_hWnd == _hWnd)
return S_OK;
CleanupDirectInput();
m_hWnd = _hWnd;
HRESULT hr;
// Setup action format for the actual gameplay
ZeroMemory( &m_diafGame, sizeof(DIACTIONFORMAT) );
m_diafGame.dwSize = sizeof(DIACTIONFORMAT);
m_diafGame.dwActionSize = sizeof(DIACTION);
m_diafGame.dwDataSize = NUMBER_OF_GAMEACTIONS * sizeof(DWORD);
m_diafGame.guidActionMap = g_guidApp;
m_diafGame.dwGenre = DIVIRTUAL_ARCADE_PLATFORM;
m_diafGame.dwNumActions = NUMBER_OF_GAMEACTIONS;
m_diafGame.rgoAction = m_rgGameAction;
m_diafGame.lAxisMin = -100;
m_diafGame.lAxisMax = 100;
m_diafGame.dwBufferSize = 32;
_tcscpy_s( m_diafGame.tszActionMap, _T("Dolphin Pad Plugin") );
// Create a new input device manager
m_pInputDeviceManager = new CMultiplayerInputDeviceManager( SAMPLE_KEY );
if( FAILED( hr = ChangeNumPlayers( 1, FALSE, FALSE ) ) )
{
MessageBox(NULL, "InitInput", "Pad", MB_OK);
return S_FALSE;
}
return S_OK;
}
// ________________________________________________________________________________________ __________
// ConfigInput
//
void
CDIHandler::ConfigInput(void)
{
HRESULT hr;
CleanupDeviceStateStructs();
// Configure the devices (with edit capability)
hr = m_pInputDeviceManager->ConfigureDevices( m_hWnd, NULL, NULL, DICD_EDIT, NULL );
if( FAILED(hr) )
{
if( hr == E_DIUTILERR_PLAYERWITHOUTDEVICE )
{
// There's a player that hasn't been assigned a device. Some games may
// want to handle this by reducing the number of players, or auto-assigning
// a device, or warning the user, etc.
MessageBox( m_hWnd, TEXT("There is at least one player that wasn't assigned ") \
TEXT("a device\n") \
TEXT("Press OK to auto-assign a device to these users"),
TEXT("Player Without Device"), MB_OK | MB_ICONEXCLAMATION );
}
// Auto-reassign every player a device.
ChangeNumPlayers( m_dwNumPlayers, FALSE, FALSE );
}
}
// ________________________________________________________________________________________ __________
// CleanupDirectInput
//
void
CDIHandler::CleanupDirectInput(void)
{
if( NULL == m_pInputDeviceManager )
return;
CleanupDeviceStateStructs();
// Cleanup DirectX input objects
SAFE_DELETE( m_pInputDeviceManager );
}
// ________________________________________________________________________________________ __________
// CleanupDeviceStateStructs
//
void
CDIHandler::CleanupDeviceStateStructs(void)
{
// Get access to the list of semantically-mapped input devices
// to delete all InputDeviceState structs before calling ConfigureDevices()
CMultiplayerInputDeviceManager::DeviceInfo* pDeviceInfos;
DWORD dwNumDevices;
m_pInputDeviceManager->GetDevices( &pDeviceInfos, &dwNumDevices );
for( DWORD i=0; i<dwNumDevices; i++ )
{
SUserInput* pInputDeviceState = (SUserInput*) pDeviceInfos[i].pParam;
SAFE_DELETE( pInputDeviceState );
pDeviceInfos[i].pParam = NULL;
}
}
// ________________________________________________________________________________________ __________
// CleanupDeviceStateStructs
//
HRESULT
CDIHandler::ChangeNumPlayers( DWORD dwNumPlayers, BOOL bResetOwnership, BOOL bResetMappings )
{
HRESULT hr;
m_dwNumPlayers = dwNumPlayers;
// Just pass in stock names. Real games may want to ask the user for a name, etc.
TCHAR* strUserNames[4] = { TEXT("Controller 1"), TEXT("Controller 2"),
TEXT("Controller 3"), TEXT("Controller 4") };
BOOL bSuccess = FALSE;
while( !bSuccess )
{
hr = m_pInputDeviceManager->Create( m_hWnd, strUserNames, m_dwNumPlayers, &m_diafGame,
StaticInputAddDeviceCB, NULL,
bResetOwnership, bResetMappings );
if( FAILED(hr) )
{
switch( hr )
{
case E_DIUTILERR_DEVICESTAKEN:
{
// It's possible that a single user could "own" too many devices for the other
// players to get into the game. If so, we reinit the manager class to provide
// each user with a device that has a default configuration.
bResetOwnership = TRUE;
MessageBox( m_hWnd, TEXT("You have entered more users than there are suitable ") \
TEXT("devices, or some users are claiming too many devices.\n") \
TEXT("Press OK to give each user a default device"),
TEXT("Devices Are Taken"), MB_OK | MB_ICONEXCLAMATION );
break;
}
case E_DIUTILERR_TOOMANYUSERS:
{
// Another common error is if more users are attempting to play than there are devices
// attached to the machine. In this case, the number of players is automatically
// lowered to make playing the game possible.
DWORD dwNumDevices = m_pInputDeviceManager->GetNumDevices();
m_dwNumPlayers = dwNumDevices;
TCHAR sz[256];
wsprintf( sz, TEXT("There are not enough devices attached to the ") \
TEXT("system for the number of users you entered.\nThe ") \
TEXT("number of users has been automatically changed to ") \
TEXT("%i (the number of devices available on the system)."),
m_dwNumPlayers );
MessageBox( m_hWnd, sz, _T("Too Many Users"), MB_OK | MB_ICONEXCLAMATION );
break;
}
default:
MessageBox(NULL, "ChangeNumPlayers", "Pad", MB_OK);
return S_FALSE;
break;
}
m_pInputDeviceManager->Cleanup();
}
else
{
bSuccess = TRUE;
}
}
return S_OK;
}
// ________________________________________________________________________________________ __________
// UpdateInput
//
void
CDIHandler::UpdateInput(void)
{
if( NULL == m_pInputDeviceManager )
return;
CMultiplayerInputDeviceManager::DeviceInfo* pDeviceInfos;
DWORD dwNumDevices;
// Get access to the list of semantically-mapped input devices
m_pInputDeviceManager->GetDevices( &pDeviceInfos, &dwNumDevices );
// Loop through all devices and check game input
for( DWORD i=0; i<dwNumDevices; i++ )
{
// skip past any devices that aren't assigned,
// since we don't care about them
if( pDeviceInfos[i].pPlayerInfo == NULL )
continue;
DIDEVICEOBJECTDATA rgdod[10];
DWORD dwItems = 10;
HRESULT hr;
LPDIRECTINPUTDEVICE8 pdidDevice = pDeviceInfos[i].pdidDevice;
SUserInput* pInputDeviceState = (SUserInput*) pDeviceInfos[i].pParam;
// dunno if we need this
if(pDeviceInfos[i].bRelativeAxis)
{
// For relative axis data, the action mapper only informs us when
// the delta data is non-zero, so we need to zero its state
// out each frame
pInputDeviceState->fMainLR = 0.0f;
pInputDeviceState->fMainUP = 0.0f;
pInputDeviceState->fCPadLR = 0.0f;
pInputDeviceState->fCPadUP = 0.0f;
pInputDeviceState->fDPadLR = 0.0f;
pInputDeviceState->fDPadUP = 0.0f;
pInputDeviceState->fTriggerL = 0.0f;
pInputDeviceState->fTriggerR = 0.0f;
}
hr = pdidDevice->Acquire();
hr = pdidDevice->Poll();
hr = pdidDevice->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), rgdod, &dwItems, 0 );
if( FAILED(hr) )
continue;
// Get the sematics codes for the game menu
for( DWORD j=0; j<dwItems; j++ )
{
bool bButtonState = (rgdod[j].dwData==0x80) ? true : false;
FLOAT fAxisState = (FLOAT)((int)rgdod[j].dwData)/100.0f;
switch( rgdod[j].uAppData )
{
// Handle relative axis data
case INPUT_MAIN_AXIS_LR: pInputDeviceState->fMainLR = fAxisState; break;
case INPUT_MAIN_AXIS_UD: pInputDeviceState->fMainUP = fAxisState; break;
case INPUT_CPAD_AXIS_LR: pInputDeviceState->fCPadLR = fAxisState; break;
case INPUT_CPAD_AXIS_UP: pInputDeviceState->fCPadUP = fAxisState; break;
case INPUT_DPAD_AXIS_LR: pInputDeviceState->fDPadLR = fAxisState; break;
case INPUT_DPAD_AXIS_UP: pInputDeviceState->fDPadUP = fAxisState; break;
// Handle buttons separately so the button state data
// doesn't overwrite the axis state data, and handle
// each button separately so they don't overwrite each other
case INPUT_MAIN_LEFT: pInputDeviceState->bMainLeft = bButtonState; break;
case INPUT_MAIN_RIGHT: pInputDeviceState->bMainRight = bButtonState; break;
case INPUT_MAIN_UP: pInputDeviceState->bMainUp = bButtonState; break;
case INPUT_MAIN_DOWN: pInputDeviceState->bMainDown = bButtonState; break;
case INPUT_CPAD_LEFT: pInputDeviceState->bCPadLeft = bButtonState; break;
case INPUT_CPAD_RIGHT: pInputDeviceState->bCPadRight = bButtonState; break;
case INPUT_CPAD_UP: pInputDeviceState->bCPadUp = bButtonState; break;
case INPUT_CPAD_DOWN: pInputDeviceState->bCPadDown = bButtonState; break;
case INPUT_DPAD_LEFT: pInputDeviceState->bDPadLeft = bButtonState; break;
case INPUT_DPAD_RIGHT: pInputDeviceState->bDPadRight = bButtonState; break;
case INPUT_DPAD_UP: pInputDeviceState->bDPadUp = bButtonState; break;
case INPUT_DPAD_DOWN: pInputDeviceState->bDPadDown = bButtonState; break;
case INPUT_BUTTON_START: pInputDeviceState->bButtonStart = bButtonState; break;
case INPUT_BUTTON_A: pInputDeviceState->bButtonA = bButtonState; break;
case INPUT_BUTTON_B: pInputDeviceState->bButtonB = bButtonState; break;
case INPUT_BUTTON_X: pInputDeviceState->bButtonX = bButtonState; break;
case INPUT_BUTTON_Y: pInputDeviceState->bButtonY = bButtonState; break;
case INPUT_BUTTON_Z: pInputDeviceState->bButtonZ = bButtonState; break;
case INPUT_BUTTON_L: pInputDeviceState->fTriggerL = bButtonState; break;
case INPUT_BUTTON_R: pInputDeviceState->fTriggerR = bButtonState; break;
}
}
}
for( DWORD iPlayer=0; iPlayer<m_dwNumPlayers; iPlayer++ )
{
SControllerInput& ctrlInput = m_controllerInput[iPlayer];
m_controllerInput[iPlayer].fMainLR = 0.0f;
m_controllerInput[iPlayer].fMainUP = 0.0f;
m_controllerInput[iPlayer].fCPadLR = 0.0f;
m_controllerInput[iPlayer].fCPadUP = 0.0f;
m_controllerInput[iPlayer].fDPadLR = 0.0f;
m_controllerInput[iPlayer].fDPadUP = 0.0f;
ctrlInput.bButtonA = false;
ctrlInput.bButtonB = false;
ctrlInput.bButtonX = false;
ctrlInput.bButtonY = false;
ctrlInput.bButtonZ = false;
ctrlInput.bButtonStart = false;
ctrlInput.fTriggerL = false;
ctrlInput.fTriggerR = false;
// Concatinate the data from all the DirectInput devices
for(DWORD i=0; i<dwNumDevices; i++)
{
// Only look at devices that are assigned to this player
if( pDeviceInfos[i].pPlayerInfo == NULL ||
pDeviceInfos[i].pPlayerInfo->dwPlayerIndex != iPlayer )
continue;
SUserInput* pInputDeviceState = (SUserInput*)pDeviceInfos[i].pParam;
// main-axis
if( fabs(pInputDeviceState->fMainLR) > fabs(ctrlInput.fMainLR) )
ctrlInput.fMainLR = pInputDeviceState->fMainLR;
if( fabs(pInputDeviceState->fMainUP) > fabs(ctrlInput.fMainUP) )
ctrlInput.fMainUP = pInputDeviceState->fMainUP;
if (pInputDeviceState->bMainLeft) ctrlInput.fMainLR = -1.0f;
if (pInputDeviceState->bMainRight) ctrlInput.fMainLR = 1.0f;
if (pInputDeviceState->bMainUp) ctrlInput.fMainUP = -1.0f;
if (pInputDeviceState->bMainDown) ctrlInput.fMainUP = 1.0f;
// CPad-axis
if( fabs(pInputDeviceState->fCPadLR) > fabs(ctrlInput.fCPadLR) )
ctrlInput.fCPadLR = pInputDeviceState->fCPadLR;
if( fabs(pInputDeviceState->fCPadUP) > fabs(ctrlInput.fCPadUP) )
ctrlInput.fCPadUP = pInputDeviceState->fCPadUP;
if (pInputDeviceState->bCPadLeft) ctrlInput.fCPadLR = -1.0f;
if (pInputDeviceState->bCPadRight) ctrlInput.fCPadLR = 1.0f;
if (pInputDeviceState->bCPadUp) ctrlInput.fCPadUP = -1.0f;
if (pInputDeviceState->bCPadDown) ctrlInput.fCPadUP = 1.0f;
// DPad-axis
if( fabs(pInputDeviceState->fDPadLR) > fabs(ctrlInput.fDPadLR) )
ctrlInput.fDPadLR = pInputDeviceState->fDPadLR;
if( fabs(pInputDeviceState->fDPadUP) > fabs(ctrlInput.fDPadUP) )
ctrlInput.fDPadUP = pInputDeviceState->fDPadUP;
if (pInputDeviceState->bDPadLeft) ctrlInput.fDPadLR = -1.0f;
if (pInputDeviceState->bDPadRight) ctrlInput.fDPadLR = 1.0f;
if (pInputDeviceState->bDPadUp) ctrlInput.fDPadUP = -1.0f;
if (pInputDeviceState->bDPadDown) ctrlInput.fDPadUP = 1.0f;
// buttons
if (pInputDeviceState->bButtonA) ctrlInput.bButtonA = true;
if (pInputDeviceState->bButtonB) ctrlInput.bButtonB = true;
if (pInputDeviceState->bButtonX) ctrlInput.bButtonX = true;
if (pInputDeviceState->bButtonY) ctrlInput.bButtonY = true;
if (pInputDeviceState->bButtonZ) ctrlInput.bButtonZ = true;
if (pInputDeviceState->bButtonStart)ctrlInput.bButtonStart = true;
if (pInputDeviceState->fTriggerL) ctrlInput.fTriggerL = true;
if (pInputDeviceState->fTriggerR) ctrlInput.fTriggerR = true;
}
}
}
// ________________________________________________________________________________________ __________
// StaticInputAddDeviceCB
//
HRESULT CALLBACK
CDIHandler::StaticInputAddDeviceCB( CMultiplayerInputDeviceManager::PlayerInfo* pPlayerInfo,
CMultiplayerInputDeviceManager::DeviceInfo* pDeviceInfo,
const DIDEVICEINSTANCE* pdidi,
LPVOID pParam)
{
CDIHandler* pApp = (CDIHandler*) pParam;
return pApp->InputAddDeviceCB( pPlayerInfo, pDeviceInfo, pdidi );
}
// ________________________________________________________________________________________ __________
// InputAddDeviceCB
//
HRESULT
CDIHandler::InputAddDeviceCB( CMultiplayerInputDeviceManager::PlayerInfo* pPlayerInfo,
CMultiplayerInputDeviceManager::DeviceInfo* pDeviceInfo,
const DIDEVICEINSTANCE* pdidi)
{
if( (GET_DIDEVICE_TYPE(pdidi->dwDevType) != DI8DEVTYPE_KEYBOARD) &&
(GET_DIDEVICE_TYPE(pdidi->dwDevType) != DI8DEVTYPE_MOUSE) )
{
// Setup the deadzone
DIPROPDWORD dipdw;
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = 500;
pDeviceInfo->pdidDevice->SetProperty( DIPROP_DEADZONE, &dipdw.diph );
}
// Create a new InputDeviceState for each device so the
// app can record its state
SUserInput* pNewInputDeviceState = new SUserInput;
ZeroMemory( pNewInputDeviceState, sizeof(SUserInput) );
pDeviceInfo->pParam = (LPVOID) pNewInputDeviceState;
return S_OK;
}

View File

@ -0,0 +1,164 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
// Struct to store the current input state
struct SControllerInput
{
float fMainLR;
float fMainUP;
float fCPadLR;
float fCPadUP;
float fDPadLR;
float fDPadUP;
bool bButtonStart;
bool bButtonA;
bool bButtonB;
bool bButtonX;
bool bButtonY;
bool bButtonZ;
float fTriggerL;
float fTriggerR;
};
class CDIHandler
{
public:
CDIHandler(void);
~CDIHandler(void);
HRESULT InitInput(HWND _hWnd);
void ConfigInput(void);
void CleanupDirectInput(void);
void UpdateInput(void);
const SControllerInput& GetControllerInput(unsigned int _number)
{
return m_controllerInput[_number];
}
private:
enum
{
MAX_AXIS = 127
};
enum INPUT_SEMANTICS
{
// Gameplay semantics
INPUT_MAIN_AXIS_LR=1,
INPUT_MAIN_AXIS_UD,
INPUT_MAIN_LEFT,
INPUT_MAIN_RIGHT,
INPUT_MAIN_UP,
INPUT_MAIN_DOWN,
INPUT_CPAD_AXIS_LR,
INPUT_CPAD_AXIS_UP,
INPUT_CPAD_LEFT,
INPUT_CPAD_RIGHT,
INPUT_CPAD_UP,
INPUT_CPAD_DOWN,
INPUT_DPAD_AXIS_LR,
INPUT_DPAD_AXIS_UP,
INPUT_DPAD_LEFT,
INPUT_DPAD_RIGHT,
INPUT_DPAD_UP,
INPUT_DPAD_DOWN,
INPUT_BUTTON_START,
INPUT_BUTTON_A,
INPUT_BUTTON_B,
INPUT_BUTTON_X,
INPUT_BUTTON_Y,
INPUT_BUTTON_Z,
INPUT_BUTTON_L,
INPUT_BUTTON_R
};
// Struct to store the current input state
struct SUserInput
{
bool bMainLeft;
bool bMainRight;
bool bMainUp;
bool bMainDown;
float fMainLR;
float fMainUP;
bool bCPadLeft;
bool bCPadRight;
bool bCPadUp;
bool bCPadDown;
float fCPadLR;
float fCPadUP;
bool bDPadLeft;
bool bDPadRight;
bool bDPadUp;
bool bDPadDown;
float fDPadLR;
float fDPadUP;
bool bButtonStart;
bool bButtonA;
bool bButtonB;
bool bButtonX;
bool bButtonY;
bool bButtonZ;
bool fTriggerL;
bool fTriggerR;
};
// handle to window that "owns" the DInput
HWND m_hWnd;
static DIACTION m_rgGameAction[];
// DirectInput multiplayer device manager
CMultiplayerInputDeviceManager* m_pInputDeviceManager;
// Action format for game play
DIACTIONFORMAT m_diafGame;
// Struct for storing user input
SControllerInput m_controllerInput[4];
// Number of players in the game
DWORD m_dwNumPlayers;
void CleanupDeviceStateStructs(void);
HRESULT ChangeNumPlayers(DWORD _dwNumPlayers, BOOL _bResetOwnership, BOOL _bResetMappings);
static HRESULT CALLBACK StaticInputAddDeviceCB(CMultiplayerInputDeviceManager::PlayerInfo* _pPlayerInfo,
CMultiplayerInputDeviceManager::DeviceInfo* _pDeviceInfo,
const DIDEVICEINSTANCE* _pdidi,
LPVOID _pParam);
HRESULT InputAddDeviceCB(CMultiplayerInputDeviceManager::PlayerInfo* _pPlayerInfo,
CMultiplayerInputDeviceManager::DeviceInfo* _pDeviceInfo,
const DIDEVICEINSTANCE* _pdidi);
};

View File

@ -0,0 +1,155 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "IniFile.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N //////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// ________________________________________________________________________________________ __________
// constructor
//
IniFile::IniFile(void)
{
}
// ________________________________________________________________________________________ __________
// destructor
//
IniFile::~IniFile(void)
{
}
// ________________________________________________________________________________________ __________
// SetFile
//
void
IniFile::SetFile(const TCHAR* _filename)
{
if (_filename)
{
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
_splitpath( path_buffer, drive, dir, fname, ext );
_makepath( filename, drive, dir, _filename, ".ini");
}
}
// ________________________________________________________________________________________ __________
// SetSection
//
void
IniFile::SetSection(const TCHAR *_section)
{
_tcscpy(section,_section);
}
// ________________________________________________________________________________________ __________
// ReadInt
//
int
IniFile::ReadInt(const TCHAR *key, int def)
{
return GetPrivateProfileInt(section, key, def, filename);
}
// ________________________________________________________________________________________ __________
// WriteInt
//
void
IniFile::WriteInt(const TCHAR *key, int value)
{
char temp[256];
WritePrivateProfileString(section, key, _itoa(value,temp,10), filename);
}
// ________________________________________________________________________________________ __________
// ReadBool
//
bool
IniFile::ReadBool(const TCHAR *key, bool def)
{
return ReadInt(key,def?1:0) == 0 ? false : true;
}
// ________________________________________________________________________________________ __________
// WriteBool
//
void
IniFile::WriteBool(const TCHAR *key, bool value)
{
WriteInt(key,value?1:0);
}
// ________________________________________________________________________________________ __________
// ReadString
//
void
IniFile::ReadString(const TCHAR *key, const TCHAR *def, TCHAR *out, int size)
{
GetPrivateProfileString(section, key, def, out, size, filename);
}
// ________________________________________________________________________________________ __________
// WriteString
//
void
IniFile::WriteString(const TCHAR *key, const TCHAR *value)
{
WritePrivateProfileString(section, key, value, filename);
}
// ________________________________________________________________________________________ __________
// ReadStringList
//
void
IniFile::ReadStringList(const TCHAR *key, std::vector<std::string> &list)
{
int count = ReadInt(key);
for (int i=0; i<count; i++)
{
char temp[256], temp2[256];
sprintf(temp,"%s%i",key,i);
ReadString(temp,"",temp2,256);
list.push_back(std::string(temp2));
}
}
// ________________________________________________________________________________________ __________
// WriteStringList
//
void
IniFile::WriteStringList(const TCHAR *key, std::vector<std::string> &list)
{
WriteInt(key,(int)list.size());
int i=0;
for (std::vector<std::string>::iterator iter = list.begin(); iter!=list.end(); iter++)
{
char temp[256];
sprintf(temp,"%s%i",key,i);
WriteString(temp,iter->c_str());
i++;
}
}

View File

@ -0,0 +1,48 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
/////////////////////////////////////////////////////////////////////////////////////////////////////
// C L A S S ////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
class IniFile
{
public:
IniFile(void);
~IniFile(void);
void SetFile(const TCHAR *fname);
void SetSection(const TCHAR *section);
int ReadInt (const TCHAR *key, int def = 0);
void WriteInt (const TCHAR *key, int value);
bool ReadBool (const TCHAR *key, bool def = false);
void WriteBool (const TCHAR *key, bool value);
void ReadString (const TCHAR *key, const TCHAR *def, TCHAR *out, int size = 255);
void WriteString(const TCHAR *key, const TCHAR *value);
void ReadStringList (const TCHAR *key, std::vector<std::string> &list);
void WriteStringList(const TCHAR *key, std::vector<std::string> &list);
private:
TCHAR filename[512];
TCHAR section[256];
};

View File

@ -0,0 +1,200 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include "PluginSpecs_Pad.h"
#include "IniFile.h"
#include "AboutDlg.h"
#include "ConfigDlg.h"
#include "multidi.h"
#include "DIHandler.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////
// T Y P E D E F S / D E F I N E S //////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
HINSTANCE g_hInstance = NULL;
SPADInitialize g_PADInitialize;
CDIHandler g_diHandler;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I M P L E M E N T A T I O N ////////////////////////// ////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// ________________________________________________________________________________________ __________
// DllMain
//
BOOL APIENTRY DllMain( HINSTANCE _hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID _lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}
g_hInstance = _hinstDLL;
return TRUE;
}
// __________________________________________________________________________________________________
// GetDllInfo
//
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifndef _DEBUG
sprintf_s(_PluginInfo->Name, 100, "Pad DirectX9");
#else
sprintf_s(_PluginInfo->Name, 100, "Pad DirectX9 (Debug)");
#endif
}
// __________________________________________________________________________________________________
// DllAbout
//
void DllAbout(HWND _hParent)
{
CAboutDlg aboutDlg;
aboutDlg.DoModal(_hParent);
}
// __________________________________________________________________________________________________
// DllConfig
//
void DllConfig(HWND _hParent)
{
g_diHandler.InitInput(_hParent);
EnableWindow(_hParent, FALSE);
g_diHandler.ConfigInput();
EnableWindow(_hParent, TRUE);
SetForegroundWindow(_hParent);
g_diHandler.CleanupDirectInput();
}
// __________________________________________________________________________________________________
// PAD_Initialize
//
void PAD_Initialize(SPADInitialize _PADInitialize)
{
g_PADInitialize = _PADInitialize;
g_diHandler.InitInput((HWND)_PADInitialize.hWnd);
}
// __________________________________________________________________________________________________
// PAD_Shutdown
//
void PAD_Shutdown(void)
{
g_diHandler.CleanupDirectInput();
}
// __________________________________________________________________________________________________
// PADGetStatus
//
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
{
// check if all is okay
if ((_numPAD != 0) || // we support just pad 0
(_pPADStatus == NULL))
return;
#ifdef RECORD_REPLAY
*_pPADStatus = PlayRecord();
return;
#endif
int base = 0x80;
// clear pad
memset(_pPADStatus,0,sizeof(SPADStatus));
_pPADStatus->stickY = base;
_pPADStatus->stickX = base;
_pPADStatus->substickX = base;
_pPADStatus->substickY = base;
_pPADStatus->button |= PAD_USE_ORIGIN;
// just update pad on focus
if (g_PADInitialize.hWnd != ::GetForegroundWindow())
return;
//get keys from dinput
g_diHandler.UpdateInput();
const SControllerInput& rInput = g_diHandler.GetControllerInput(_numPAD);
// int mainvalue = (dinput.diks[keyForControl[CTL_HALFMAIN]] &0xFF) ? 40 : 100;
// int subvalue = (dinput.diks[keyForControl[CTL_HALFSUB]] &0xFF) ? 40 : 100;
// int triggervalue = (dinput.diks[keyForControl[CTL_HALFTRIGGER]]&0xFF) ? 100 : 255;
// get the new keys
if (rInput.bButtonStart) _pPADStatus->button |= PAD_BUTTON_START;
if (rInput.bButtonA) {_pPADStatus->button |= PAD_BUTTON_A; _pPADStatus->analogA = 255;}
if (rInput.bButtonB) {_pPADStatus->button |= PAD_BUTTON_B; _pPADStatus->analogB = 255;}
if (rInput.bButtonX) _pPADStatus->button |= PAD_BUTTON_X;
if (rInput.bButtonY) _pPADStatus->button |= PAD_BUTTON_Y;
if (rInput.bButtonZ) _pPADStatus->button |= PAD_TRIGGER_Z;
if (rInput.fDPadLR < 0) _pPADStatus->button |= PAD_BUTTON_UP;
if (rInput.fDPadLR > 0) _pPADStatus->button |= PAD_BUTTON_DOWN;
if (rInput.fDPadUP < 0) _pPADStatus->button |= PAD_BUTTON_LEFT;
if (rInput.fDPadUP > 0) _pPADStatus->button |= PAD_BUTTON_RIGHT;
if (rInput.fTriggerL > 0) {_pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->triggerLeft = 255;}
if (rInput.fTriggerR > 0) {_pPADStatus->button |= PAD_TRIGGER_R; _pPADStatus->triggerRight = 255;}
_pPADStatus->stickX = 0x80 + (unsigned __int8)(rInput.fMainLR * 127.f);
_pPADStatus->stickY = 0x80 + (unsigned __int8)(rInput.fMainUP * -127.f);
_pPADStatus->substickX = 0x80 + (unsigned __int8)(rInput.fCPadLR * 127.f);
_pPADStatus->substickY = 0x80 + (unsigned __int8)(rInput.fCPadUP * -127.f);
_pPADStatus->err = PAD_ERR_NONE;
}
// __________________________________________________________________________________________________
// PAD_Rumble
//
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength)
{
}
// __________________________________________________________________________________________________
// SaveLoadState
//
unsigned __int32 SaveLoadState(char* _ptr, BOOL _bSave)
{
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
//-----------------------------------------------------------------------------
// File: MultiDI.h
//
// Desc: Multiple user DirectInput support using action mapping
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#ifndef MULTIDI_H
#define MULTIDI_H
#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800
#endif
#include <dinput.h>
//-----------------------------------------------------------------------------
// Miscellaneous helper functions
//-----------------------------------------------------------------------------
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
HRESULT DXUtil_WriteStringRegKey( HKEY hKey, LPCTSTR strRegName, LPCTSTR strValue );
HRESULT DXUtil_ReadStringRegKeyCch( HKEY hKey, LPCTSTR strRegName, TCHAR* strDest, DWORD cchDest, LPCTSTR strDefault );
HRESULT DXUtil_ConvertGUIDToStringCch( const GUID* pGuidSrc, TCHAR* strDest, int cchDestChar );
HRESULT DXUtil_ConvertWideStringToGenericCch( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar );
//-----------------------------------------------------------------------------
// Name: DXUtil_Timer()
// Desc: Performs timer opertations. Use the following commands:
// TIMER_RESET - to reset the timer
// TIMER_START - to start the timer
// TIMER_STOP - to stop (or pause) the timer
// TIMER_ADVANCE - to advance the timer by 0.1 seconds
// TIMER_GETABSOLUTETIME - to get the absolute system time
// TIMER_GETAPPTIME - to get the current time
// TIMER_GETELAPSEDTIME - to get the time that elapsed between
// TIMER_GETELAPSEDTIME calls
//-----------------------------------------------------------------------------
enum TIMER_COMMAND { TIMER_RESET, TIMER_START, TIMER_STOP, TIMER_ADVANCE,
TIMER_GETABSOLUTETIME, TIMER_GETAPPTIME, TIMER_GETELAPSEDTIME };
FLOAT __stdcall DXUtil_Timer( TIMER_COMMAND command );
// E_DIUTILERR_PLAYERWITHOUTDEVICE is returned by the manager class after configuring
// device, and there's a player that hasn't been assigned a device.
#define E_DIUTILERR_PLAYERWITHOUTDEVICE MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,997)
// E_DIUTILERR_DEVICESTAKEN is returned by the manager class when one player
// on the machine has enough RECENT devices to prevent other players from
// playing. This return code is needed because this sample attempts to give
// all RECENT devices to that player.
#define E_DIUTILERR_DEVICESTAKEN MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,998)
// E_DIUTILERR_TOOMANYUSERS is returned by the manager class when the number of
// players exceeds the number of devices present on the system. For example,
// if you ask for 4 players on a machine that only has a keyboard and mouse,
// you're 2 short of what you need.
#define E_DIUTILERR_TOOMANYUSERS MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,999)
//-----------------------------------------------------------------------------
// Name: class CMultiplayerInputDeviceManager
// Desc: Input device manager using DX8 action mapping
//-----------------------------------------------------------------------------
class CMultiplayerInputDeviceManager
{
public:
struct PlayerInfo
{
DWORD dwPlayerIndex; // 0-based player number
TCHAR strPlayerName[MAX_PATH]; // player name
DWORD dwMaxDevices; // max number of elements in pDevices array
DWORD dwNumDevices; // current number of elements in pDevices array
BOOL bFoundDeviceForPlayer; // if a device has been found for this player yet
};
struct DeviceInfo
{
LPDIRECTINPUTDEVICE8 pdidDevice; // dinput device pointer
PlayerInfo* pPlayerInfo; // Player who owns this device
BOOL bRelativeAxis; // TRUE if device is using relative axis
BOOL bMapsPri1Actions; // TRUE if device maps pri 1 actions
BOOL bMapsPri2Actions; // TRUE if device maps pri 2 actions
LPVOID pParam; // app defined pointer assoicated with this device
DIDEVICEINSTANCE didi; // device instance info
};
typedef HRESULT (CALLBACK *LPDIMANAGERCALLBACK)(CMultiplayerInputDeviceManager::PlayerInfo* pPlayerInfo, CMultiplayerInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi, LPVOID);
private:
BOOL m_bCleanupCOM;
HWND m_hWnd;
LPDIRECTINPUT8 m_pDI;
DIACTIONFORMAT* m_pdiaf;
PlayerInfo** m_pUsers;
DWORD m_dwNumUsers;
DeviceInfo* m_pDeviceList;
DWORD m_dwNumDevices;
DWORD m_dwMaxDevices;
LPDIMANAGERCALLBACK m_AddDeviceCallback;
LPVOID m_AddDeviceCallbackParam;
TCHAR* m_strKey;
HKEY m_hKey;
public:
static BOOL CALLBACK StaticEnumSuitableDevicesCB( LPCDIDEVICEINSTANCE pdidi, LPDIRECTINPUTDEVICE8 pdidDevice, DWORD dwFlags, DWORD dwRemainingDevices, VOID* pContext );
static BOOL CALLBACK StaticBuildDeviceListCB( LPCDIDEVICEINSTANCE pdidi, VOID* pContext );
// Device control
BOOL EnumDevice( const DIDEVICEINSTANCE* pdidi, LPDIRECTINPUTDEVICE8 pdidDevice, DWORD dwFlags, DWORD dwDeviceRemaining );
BOOL BuildDeviceListCB( LPCDIDEVICEINSTANCE pdidi );
HRESULT AddDevice( DeviceInfo* pDeviceInfo, BOOL bForceReset );
HRESULT GetDevices( DeviceInfo** ppDeviceInfo, DWORD* pdwNumDevices );
HRESULT ConfigureDevices( HWND hWnd, IUnknown* pSurface, VOID* pCallback, DWORD dwFlags, LPVOID pvCBParam );
DWORD GetNumDevices() { return m_dwNumDevices; }
VOID UnacquireDevices();
VOID SetFocus( HWND hWnd );
PlayerInfo* LookupPlayer( TCHAR* strPlayerName );
HRESULT SaveDeviceOwnershipKeys();
VOID DeleteDeviceOwnershipKeys();
HRESULT UpdateDeviceOwnership();
HRESULT AssignDevices();
HRESULT VerifyAssignment();
HRESULT AddAssignedDevices( BOOL bResetMappings );
HRESULT BuildDeviceList();
VOID CleanupDeviceList();
// Construction
HRESULT SetActionFormat( DIACTIONFORMAT* pdiaf, BOOL bReenumerate, BOOL bResetOwnership, BOOL bResetMappings );
HRESULT Create( HWND hWnd, TCHAR* strUserNames[], DWORD dwNumUsers, DIACTIONFORMAT* pdiaf, LPDIMANAGERCALLBACK AddDeviceCallback, LPVOID pCallbackParam, BOOL bResetOwnership, BOOL bResetMappings );
CMultiplayerInputDeviceManager( TCHAR* strRegKey );
~CMultiplayerInputDeviceManager();
VOID Cleanup();
};
#endif

View File

@ -0,0 +1,37 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PadPlugin2.rc
//
#define IDD_PADCONFIG 101
#define IDD_ABOUTPAD 104
#define IDC_SETSTART 1003
#define IDC_SETA 1004
#define IDC_SETB 1005
#define IDC_SETX 1006
#define IDC_SETY 1007
#define IDC_SETZ 1008
#define IDC_SETSUBUP 1009
#define IDC_SETSUBLEFT 1010
#define IDC_SETSUBRIGHT 1011
#define IDC_SETSUBDOWN 1012
#define IDC_SETDPADUP 1013
#define IDC_SETDPADLEFT 1014
#define IDC_SETDPADRIGHT 1015
#define IDC_SETDPADDOWN 1016
#define IDC_SETMAINUP 1017
#define IDC_SETMAINLEFT 1018
#define IDC_SETMAINDOWN 1019
#define IDC_SETMAINRIGHT 1020
#define IDC_SETL 1021
#define IDC_SETR 1022
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,135 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_PADCONFIG DIALOGEX 0, 0, 332, 226
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Pad configuration"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Close",IDOK,275,205,50,14
PUSHBUTTON "start",IDC_SETSTART,141,102,40,14
PUSHBUTTON "a",IDC_SETA,243,82,40,14
PUSHBUTTON "b",IDC_SETB,215,98,40,14
PUSHBUTTON "x",IDC_SETX,200,71,40,14
PUSHBUTTON "y",IDC_SETY,285,90,40,14
PUSHBUTTON "z",IDC_SETZ,241,35,40,14
PUSHBUTTON " ",IDC_SETSUBUP,235,128,40,14
PUSHBUTTON " ",IDC_SETSUBLEFT,193,147,40,14
PUSHBUTTON " ",IDC_SETSUBRIGHT,275,146,40,14
PUSHBUTTON " ",IDC_SETSUBDOWN,236,167,40,14
PUSHBUTTON " ",IDC_SETDPADUP,66,129,40,14
PUSHBUTTON " ",IDC_SETDPADLEFT,23,145,40,14
PUSHBUTTON " ",IDC_SETDPADRIGHT,112,145,40,14
PUSHBUTTON " ",IDC_SETDPADDOWN,67,166,40,14
PUSHBUTTON " ",IDC_SETMAINUP,41,47,40,14
PUSHBUTTON " ",IDC_SETMAINLEFT,7,66,40,14
PUSHBUTTON " ",IDC_SETMAINDOWN,41,86,40,14
PUSHBUTTON " ",IDC_SETMAINRIGHT,79,66,40,14
PUSHBUTTON "l",IDC_SETL,91,16,40,14
PUSHBUTTON "r",IDC_SETR,216,16,40,14
END
IDD_ABOUTPAD DIALOGEX 0, 0, 184, 76
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "About Dolphin Simple Pad Plugin"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,127,55,50,14
LTEXT "Coded by F|RES and ector",IDC_STATIC,73,7,104,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_PADCONFIG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 325
TOPMARGIN, 7
BOTTOMMARGIN, 219
END
IDD_ABOUTPAD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 177
TOPMARGIN, 7
BOTTOMMARGIN, 69
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,21 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"

View File

@ -0,0 +1,41 @@
// 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/
/////////////////////////////////////////////////////////////////////////////////////////////////////
// M O D U L E B E G I N ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <vector>
#include <xstring>
// DInput
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
// WTL
#include <atlbase.h>
#include <atlapp.h>
#include <atldlgs.h>
#include <atlctrls.h>

View File

@ -0,0 +1,863 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Plugin_PadSimple"
ProjectGUID="{9A183B48-ECC2-4121-876A-9B3793686073}"
RootNamespace="Plugin_PadSimple"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimple.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_Simple.pdb"
ImportLibrary=".\Release/Pad_Simple.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Release/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimple.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_Simple.pdb"
ImportLibrary=".\Release/Pad_Simple.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimpleD.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Pad_Simple.pdb"
ImportLibrary=".\Debug/Pad_Simple.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Debug/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleD.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/Pad_Simple.pdb"
ImportLibrary=".\Debug/Pad_Simple.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimple.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_Simple.pdb"
ImportLibrary=".\Release/Pad_Simple.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="3"
TypeLibraryName=".\Release/Pad_Simple.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../../Externals/WTL80;../../PluginSpecs;../../Core/Common/Src"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
ForcedIncludeFiles="stdafx.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimple.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
ProgramDatabaseFile=".\Release/Pad_Simple.pdb"
ImportLibrary=".\Release/Pad_Simple.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="AboutDialog"
>
<File
RelativePath=".\Src\AboutDlg.cpp"
>
</File>
<File
RelativePath=".\Src\AboutDlg.h"
>
</File>
</Filter>
<Filter
Name="ConfigDialog"
>
<File
RelativePath=".\Src\ConfigDlg.cpp"
>
</File>
<File
RelativePath=".\Src\ConfigDlg.h"
>
</File>
</Filter>
<Filter
Name="DirectInputBase"
>
<File
RelativePath=".\Src\DirectInputBase.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\DirectInputBase.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
>
<File
RelativePath=".\Src\resource.h"
>
</File>
<File
RelativePath=".\Src\resource.rc"
>
</File>
</Filter>
<File
RelativePath=".\Src\main.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\PluginSpecs\pluginspecs_pad.h"
>
</File>
<File
RelativePath=".\Src\stdafx.cpp"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="DebugFast|x64"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;PAD_SIMPLE_EXPORTS;$(NoInherit)"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Src\stdafx.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,36 @@
// 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 "resource.h"
#include "AboutDlg.h"
LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CenterWindow(GetParent());
return(TRUE);
}
LRESULT CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return(0);
}

View File

@ -0,0 +1,41 @@
// 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
class CAboutDlg
: public CDialogImpl<CAboutDlg>
{
public:
enum { IDD = IDD_ABOUTPAD };
BEGIN_MSG_MAP(CAboutDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
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 OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
};

View File

@ -0,0 +1,187 @@
// 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 <windowsx.h>
#include "resource.h"
#include "DirectInputBase.h"
#include "ConfigDlg.h"
#define NUMCONTROLS 23
int m_buttonResources[NUMCONTROLS] =
{
IDC_SETMAINLEFT,
IDC_SETMAINUP,
IDC_SETMAINRIGHT,
IDC_SETMAINDOWN,
IDC_SETSUBLEFT,
IDC_SETSUBUP,
IDC_SETSUBRIGHT,
IDC_SETSUBDOWN,
IDC_SETDPADLEFT,
IDC_SETDPADUP,
IDC_SETDPADRIGHT,
IDC_SETDPADDOWN,
IDC_SETA,
IDC_SETB,
IDC_SETX,
IDC_SETY,
IDC_SETZ,
IDC_SETL,
IDC_SETR,
IDC_SETSTART,
// CTL_HALFMAIN,
// CTL_HALFSUB,
// CTL_HALFTRIGGER,
// NUMCONTROLS
};
extern int keyForControl[NUMCONTROLS];
extern bool g_rumbleEnable;
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
m_dinput.Init(m_hWnd);
CenterWindow(GetParent());
for (int i = 0; i < NUMCONTROLS - 3; i++)
{
CButton button = GetDlgItem(m_buttonResources[i]);
SetButtonText(button, keyForControl[i]);
}
m_hWaitForKeyButton = NULL;
CheckDlgButton(IDC_RUMBLE1, g_rumbleEnable);
SetTimer(1, 50, 0);
return(TRUE);
}
LRESULT CConfigDlg::OnCommand(UINT /*uMsg*/, WPARAM _wParam, LPARAM _lParam, BOOL& _bHandled)
{
// we have not handled it
_bHandled = FALSE;
// check if it is a key
for (int i = 0; i < NUMCONTROLS; i++)
{
if (m_buttonResources[i] == LOWORD(_wParam))
{
m_iKeyWaitingFor = i;
m_hWaitForKeyButton = GetDlgItem(m_buttonResources[i]);
CButton tmpButton = m_hWaitForKeyButton;
tmpButton.SetWindowText("Press Key");
_bHandled = TRUE; // yeah we have handled it
break;
}
}
g_rumbleEnable = Button_GetCheck(GetDlgItem(IDC_RUMBLE1)) ? true : false;
return(TRUE);
}
LRESULT CConfigDlg::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if (m_hWaitForKeyButton != NULL)
{
m_dinput.Read();
for (int i = 0; i < 255; i++)
{
if (m_dinput.diks[i])
{
keyForControl[m_iKeyWaitingFor] = i;
CButton tmpButton = m_hWaitForKeyButton;
SetButtonText(tmpButton, keyForControl[m_iKeyWaitingFor]);
m_hWaitForKeyButton = NULL;
break;
}
}
}
return(TRUE);
}
LRESULT CConfigDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
m_dinput.Free();
EndDialog(wID);
return(0);
}
void CConfigDlg::SetButtonText(CButton& _rButton, int _key)
{
char szTemp[64];
switch (_key)
{
case DIK_LEFT:
strcpy(szTemp, "Left");
break;
case DIK_UP:
strcpy(szTemp, "Up");
break;
case DIK_RIGHT:
strcpy(szTemp, "Right");
break;
case DIK_DOWN:
strcpy(szTemp, "Down");
break;
case DIK_HOME:
strcpy(szTemp, "Home");
break;
case DIK_END:
strcpy(szTemp, "End");
break;
case DIK_INSERT:
strcpy(szTemp, "Ins");
break;
case DIK_DELETE:
strcpy(szTemp, "Del");
break;
case DIK_PGUP:
strcpy(szTemp, "PgUp");
break;
case DIK_PGDN:
strcpy(szTemp, "PgDn");
break;
default:
GetKeyNameText(_key << 16, szTemp, 64);
break;
}
_rButton.SetWindowText(szTemp);
}

View File

@ -0,0 +1,50 @@
// 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
class CConfigDlg
: public CDialogImpl<CConfigDlg>
{
public:
enum { IDD = IDD_PADCONFIG };
BEGIN_MSG_MAP(CConfigDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
MESSAGE_HANDLER(WM_TIMER, OnTimer)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
END_MSG_MAP()
private:
HWND m_hWaitForKeyButton;
int m_iKeyWaitingFor;
DInput m_dinput;
// 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 OnCommand(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/);
void SetButtonText(CButton& _rButton, int _key);
};

Some files were not shown because too many files have changed in this diff Show More