DSP plugin merge - the two DSP plugins are now gone and all the code has been merged into Dolphin.

This WILL temporarily break the Linux and MacOSX builds but should be easy to fix.

Things left to do:
  * The UI on the new Audio tab for the LLE/HLE choice is ugly
  * At times the code still look "plugin-y" and needs cleanup
  * The two plugins should be merged further. DSPHLE should use the emulated memory etc of DSPLLE as much as possible, so that simply saving the DSPLLE state is enough. This would also bring the possibility of savestate compatibility between the two plugins.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6947 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2011-01-28 18:39:30 +00:00
parent 976420b9d5
commit 419d6a244b
116 changed files with 1271 additions and 3914 deletions
+5 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="AudioCommon"
ProjectGUID="{FBAFB369-07EB-4460-9CAD-08BE5789DAB6}"
RootNamespace="AudioCommon"
@@ -62,6 +62,7 @@
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib"
AdditionalLibraryDirectories=""
/>
<Tool
@@ -126,6 +127,7 @@
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib"
AdditionalLibraryDirectories=""
/>
<Tool
@@ -325,6 +327,7 @@
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib"
AdditionalLibraryDirectories=""
/>
<Tool
@@ -388,6 +391,7 @@
/>
<Tool
Name="VCLibrarianTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib"
AdditionalLibraryDirectories=""
/>
<Tool
+4 -4
View File
@@ -28,7 +28,7 @@
namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer)
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
{
// This looks evil.
if (!mixer)
@@ -38,9 +38,9 @@ namespace AudioCommon
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
soundStream = new OpenALStream(mixer);
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
soundStream = new NullSound(mixer, g_dspInitialize.hWnd);
soundStream = new NullSound(mixer, hWnd);
else if (backend == BACKEND_DIRECTSOUND && DSound::isValid())
soundStream = new DSound(mixer, g_dspInitialize.hWnd);
soundStream = new DSound(mixer, hWnd);
else if (backend == BACKEND_XAUDIO2 && XAudio2::isValid())
soundStream = new XAudio2(mixer);
else if (backend == BACKEND_AOSOUND && AOSound::isValid())
@@ -86,7 +86,7 @@ namespace AudioCommon
soundStream = NULL;
}
INFO_LOG(DSPHLE, "Done shutting down sound stream");
NOTICE_LOG(DSPHLE, "Done shutting down sound stream");
}
std::vector<std::string> GetSoundBackends()
+1 -3
View File
@@ -20,13 +20,11 @@
#include "Common.h"
#include "AudioCommonConfig.h"
#include "../../../PluginSpecs/pluginspecs_dsp.h"
#include "SoundStream.h"
class CMixer;
extern DSPInitialize g_dspInitialize;
extern SoundStream *soundStream;
extern AudioCommonConfig ac_Config;
@@ -57,7 +55,7 @@ union UDSPControl
namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer = NULL);
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd);
void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends();
bool UseJIT();
@@ -16,8 +16,12 @@
// http://code.google.com/p/dolphin-emu/
#include "AudioCommon.h"
AudioCommonConfig ac_Config;
// This shouldn't be a global, at least not here.
SoundStream *soundStream;
// Load from given file
void AudioCommonConfig::Load(IniFile &file) {
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
+2 -2
View File
@@ -125,9 +125,9 @@ bool DSound::Start()
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
return false;
if (g_dspInitialize.hWnd)
if (hWnd)
{
HRESULT hr = ds->SetCooperativeLevel((HWND)g_dspInitialize.hWnd, DSSCL_PRIORITY);
HRESULT hr = ds->SetCooperativeLevel((HWND)hWnd, DSSCL_PRIORITY);
}
if (!CreateBuffer())
return false;
+2 -1
View File
@@ -60,13 +60,14 @@ class DSound : public SoundStream
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
public:
DSound(CMixer *mixer, void *hWnd = NULL)
DSound(CMixer *mixer, void *_hWnd = NULL)
: SoundStream(mixer)
, bufferSize(0)
, currentPos(0)
, lastPos(0)
, dsBuffer(0)
, ds(0)
, hWnd(_hWnd)
{}
virtual ~DSound() {}
+13 -14
View File
@@ -21,6 +21,11 @@
#include "AudioCommon.h"
#include "CPUDetect.h"
#include "../../Core/Src/HW/AudioInterface.h"
// UGLINESS
#include "../../Core/Src/PowerPC/PowerPC.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
#endif
@@ -33,14 +38,11 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
if (!samples)
return 0;
if (g_dspInitialize.pEmulatorState)
if (PowerPC::GetState() != 0)
{
if (*g_dspInitialize.pEmulatorState != 0)
{
// Silence
memset(samples, 0, numSamples * 4);
return numSamples;
}
// Silence
memset(samples, 0, numSamples * 4);
return numSamples;
}
unsigned int numLeft = Common::AtomicLoad(m_numSamples);
@@ -127,7 +129,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
if (m_EnableDTKMusic)
{
// Re-sampling is done inside
g_dspInitialize.pGetAudioStreaming(samples, numSamples, m_sampleRate);
AudioInterface::Callback_GetStreaming(samples, numSamples, m_sampleRate);
}
Common::AtomicAdd(m_numSamples, -(s32)numLeft);
@@ -136,18 +138,15 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
}
void CMixer::PushSamples(short *samples, unsigned int num_samples)
void CMixer::PushSamples(const short *samples, unsigned int num_samples)
{
if (m_throttle)
{
// The auto throttle function. This loop will put a ceiling on the CPU MHz.
while (num_samples + Common::AtomicLoad(m_numSamples) > MAX_SAMPLES)
{
if (g_dspInitialize.pEmulatorState)
{
if (*g_dspInitialize.pEmulatorState != 0)
break;
}
if (*PowerPC::GetStatePtr() != 0)
break;
// Shortcut key for Throttle Skipping
#ifdef _WIN32
if (GetAsyncKeyState(VK_TAB)) break;;
+2 -2
View File
@@ -48,11 +48,11 @@ public:
// Called from audio threads
virtual unsigned int Mix(short* samples, unsigned int numSamples);
virtual void Premix(short *samples, unsigned int numSamples) {}
virtual void Premix(short * /*samples*/, unsigned int /*numSamples*/) {}
unsigned int GetNumSamples();
// Called from main thread
virtual void PushSamples(short* samples, unsigned int num_samples);
virtual void PushSamples(const short* samples, unsigned int num_samples);
unsigned int GetSampleRate() {return m_sampleRate;}
void SetThrottle(bool use) { m_throttle = use;}
+1 -9
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common"
@@ -464,14 +464,6 @@
RelativePath=".\Src\Plugin.h"
>
</File>
<File
RelativePath=".\Src\PluginDSP.cpp"
>
</File>
<File
RelativePath=".\Src\PluginDSP.h"
>
</File>
<File
RelativePath=".\Src\PluginVideo.cpp"
>
-62
View File
@@ -1,62 +0,0 @@
// Copyright (C) 2003 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 "PluginDSP.h"
namespace Common {
PluginDSP::PluginDSP(const char *_Filename)
: CPlugin(_Filename), validDSP(false)
{
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox>
(LoadSymbol("DSP_ReadMailboxHigh"));
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox>
(LoadSymbol("DSP_ReadMailboxLow"));
DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox>
(LoadSymbol("DSP_WriteMailboxHigh"));
DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox>
(LoadSymbol("DSP_WriteMailboxLow"));
DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister>
(LoadSymbol("DSP_ReadControlRegister"));
DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister>
(LoadSymbol("DSP_WriteControlRegister"));
DSP_Update = reinterpret_cast<TDSP_Update>
(LoadSymbol("DSP_Update"));
DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer>
(LoadSymbol("DSP_SendAIBuffer"));
DSP_StopSoundStream = reinterpret_cast<TDSP_StopSoundStream>
(LoadSymbol("DSP_StopSoundStream"));
DSP_ClearAudioBuffer = reinterpret_cast<TDSP_ClearAudioBuffer>
(LoadSymbol("DSP_ClearAudioBuffer"));
if ((DSP_ReadMailboxHigh != 0) &&
(DSP_ReadMailboxLow != 0) &&
(DSP_WriteMailboxHigh != 0) &&
(DSP_WriteMailboxLow != 0) &&
(DSP_ReadControlRegister != 0) &&
(DSP_WriteControlRegister != 0) &&
(DSP_SendAIBuffer != 0) &&
(DSP_Update != 0) &&
(DSP_StopSoundStream != 0) &&
(DSP_ClearAudioBuffer != 0))
validDSP = true;
}
PluginDSP::~PluginDSP() {
}
} // namespace
-60
View File
@@ -1,60 +0,0 @@
// Copyright (C) 2003 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 _PLUGINDSP_H_
#define _PLUGINDSP_H_
#include "pluginspecs_dsp.h"
#include "Plugin.h"
namespace Common {
typedef void (__cdecl* TDSP_WriteMailBox)(bool _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(bool _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl *TDSP_SendAIBuffer)(unsigned int address, unsigned int num_samples);
typedef void (__cdecl *TDSP_Update)(int cycles);
typedef void (__cdecl *TDSP_StopSoundStream)();
typedef void (__cdecl *TDSP_ClearAudioBuffer)();
class PluginDSP : public CPlugin
{
public:
PluginDSP(const char *_Filename);
virtual ~PluginDSP();
virtual bool IsValid() {return validDSP;};
TDSP_ReadMailBox DSP_ReadMailboxHigh;
TDSP_ReadMailBox DSP_ReadMailboxLow;
TDSP_WriteMailBox DSP_WriteMailboxHigh;
TDSP_WriteMailBox DSP_WriteMailboxLow;
TDSP_ReadControlRegister DSP_ReadControlRegister;
TDSP_WriteControlRegister DSP_WriteControlRegister;
TDSP_SendAIBuffer DSP_SendAIBuffer;
TDSP_Update DSP_Update;
TDSP_StopSoundStream DSP_StopSoundStream;
TDSP_ClearAudioBuffer DSP_ClearAudioBuffer;
private:
bool validDSP;
};
} // namespace
#endif // _PLUGINDSP_H_
+27
View File
@@ -13,6 +13,7 @@ set(SRCS Src/ActionReplay.cpp
Src/OnFrame.cpp
Src/PatchEngine.cpp
Src/PluginManager.cpp
Src/PluginDSP.cpp
Src/State.cpp
Src/stdafx.cpp
Src/Tracer.cpp
@@ -32,6 +33,32 @@ set(SRCS Src/ActionReplay.cpp
Src/HW/AudioInterface.cpp
Src/HW/CPU.cpp
Src/HW/DSP.cpp
Src/DSPHandler.cpp
Src/MailHandler.cpp
Src/HLEMixer.cpp
Src/main.cpp
Src/Config.cpp
Src/HW/DSPHLE/UCodes/UCode_AX.cpp
Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp
Src/HW/DSPHLE/UCodes/UCode_CARD.cpp
Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp
Src/HW/DSPHLE/UCodes/UCode_ROM.cpp
Src/HW/DSPHLE/UCodes/UCodes.cpp
Src/HW/DSPHLE/UCodes/UCode_GBA.cpp
Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp
Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp
Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp
Src/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp)
Src/HW/DSPHLE/DSPHandler.cpp
Src/HW/DSPHLE/HLEMixer.cpp
Src/HW/DSPHLE/MailHandler.cpp
Src/HW/DSPHLE/DSPHLE.cpp
Src/HW/DSPLLE/DSPDebugInterface.cpp
Src/HW/DSPLLE/DSPHost.cpp
Src/HW/DSPLLE/DSPSymbols.cpp
Src/HW/DSPLLE/DSPLLEGlobals.cpp
Src/HW/DSPLLE/DSPLLE.cpp
Src/HW/DSPLLE/DSPLLETools.cpp
Src/HW/DVDInterface.cpp
Src/HW/EXI_Channel.cpp
Src/HW/EXI.cpp
+203 -7
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="Core"
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
RootNamespace="Core"
@@ -45,7 +45,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -116,7 +116,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -191,7 +191,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@@ -269,7 +269,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@@ -344,7 +344,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="true"
@@ -419,7 +419,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\DSPCore\Src;..\AudioCommon\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib;..\..\..\Externals\Lua;..\..\..\Externals\SFML\include"
PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
@@ -719,6 +719,190 @@
RelativePath=".\Src\Hw\DSP.h"
>
</File>
<Filter
Name="HLE"
>
<File
RelativePath=".\Src\HW\DSPHLE\DSPHandler.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\DSPHandler.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\DSPHLE.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\DSPHLE.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\DSPHLEGlobals.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\HLEMixer.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\HLEMixer.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\MailHandler.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\MailHandler.h"
>
</File>
<Filter
Name="UCodes"
>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AX.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AX.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AX_ADPCM.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AX_Voice.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AXStructs.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AXWii.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_AXWii.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_CARD.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_CARD.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_GBA.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_GBA.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_InitAudioSystem.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_InitAudioSystem.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_ROM.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_ROM.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda_ADPCM.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda_Obsolete.txt"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda_Synth.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCode_Zelda_Voice.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCodes.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPHLE\UCodes\UCodes.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="LLE"
>
<File
RelativePath=".\Src\HW\DSPLLE\DSPDebugInterface.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPDebugInterface.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPHost.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLE.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLE.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLEGlobals.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLEGlobals.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLETools.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPLLETools.h"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPSymbols.cpp"
>
</File>
<File
RelativePath=".\Src\HW\DSPLLE\DSPSymbols.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="DI - DVD Interface"
@@ -1513,6 +1697,10 @@
>
</File>
</Filter>
<File
RelativePath=".\CMakeLists.txt"
>
</File>
<File
RelativePath=".\Src\ConfigManager.cpp"
>
@@ -1585,6 +1773,14 @@
RelativePath=".\Src\PatchEngine.h"
>
</File>
<File
RelativePath=".\Src\PluginDSP.cpp"
>
</File>
<File
RelativePath=".\Src\PluginDSP.h"
>
</File>
<File
RelativePath=".\Src\PluginManager.cpp"
>
+2 -2
View File
@@ -155,6 +155,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE);
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
@@ -184,7 +185,6 @@ void SConfig::SaveSettings()
// Plugins
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
m_SYSCONF->Save();
@@ -280,6 +280,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);
ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true);
ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true);
ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
ini.Get("Core", "LockThreads", &m_LocalCoreStartupParameter.bLockThreads, false);
@@ -318,7 +319,6 @@ void SConfig::LoadSettings()
// Plugins
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
}
m_SYSCONF = new SysConf();
+3 -20
View File
@@ -59,6 +59,7 @@
#include "PowerPC/JitCommon/JitBase.h"
#include "PluginManager.h"
#include "PluginDSP.h"
#include "ConfigManager.h"
#include "VolumeHandler.h"
@@ -369,24 +370,7 @@ void EmuThread()
Callback_PeekMessages = VideoInitialize.pPeekMessages;
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
// Load and init DSPPlugin
DSPInitialize dspInit;
dspInit.hWnd = g_pWindowHandle;
dspInit.pARAM_Read_U8 = (u8 (__cdecl *)(const u32))DSP::ReadARAM;
dspInit.pARAM_Write_U8 = (void (__cdecl *)(const u8, const u32))DSP::WriteARAM;
dspInit.pGetARAMPointer = DSP::GetARAMPtr;
dspInit.pGetMemoryPointer = Memory::GetPointer;
dspInit.pLog = Callback_DSPLog;
dspInit.pName = Callback_ISOName;
dspInit.pDebuggerBreak = Callback_DebuggerBreak;
dspInit.pGenerateDSPInterrupt = Callback_DSPInterrupt;
dspInit.pGetAudioStreaming = AudioInterface::Callback_GetStreaming;
dspInit.pGetSampleRate = AudioInterface::Callback_GetSampleRate;
dspInit.pEmulatorState = (int *)PowerPC::GetStatePtr();
dspInit.bWii = _CoreParameter.bWii;
dspInit.bOnThread = _CoreParameter.bDSPThread;
Plugins.GetDSP()->Initialize((void *)&dspInit);
DSP::GetPlugin()->Initialize(g_pWindowHandle, _CoreParameter.bWii, _CoreParameter.bDSPThread);
Pad::Initialize(g_pWindowHandle);
@@ -484,7 +468,7 @@ void EmuThread()
// Stop audio thread - Actually this does nothing on HLE plugin.
// But stops the DSP Interpreter on LLE plugin.
Plugins.GetDSP()->DSP_StopSoundStream();
DSP::GetPlugin()->DSP_StopSoundStream();
// We must set up this flag before executing HW::Shutdown()
g_bHwInit = false;
@@ -499,7 +483,6 @@ void EmuThread()
Pad::Shutdown();
Wiimote::Shutdown();
Plugins.ShutdownPlugins();
NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Plugins shutdown").c_str());
+2 -1
View File
@@ -42,7 +42,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bJITBranchOff(false), bJITProfiledReJIT(false),
bJITILTimeProfiling(false), bJITILOutputIR(false),
bEnableFPRF(false),
bCPUThread(true), bDSPThread(false),
bCPUThread(true), bDSPThread(false), bDSPHLE(true),
bSkipIdle(true), bNTSC(false), bNTSCJ(false),
bHLE_BS2(true), bUseFastMem(false),
bLockThreads(false),
@@ -72,6 +72,7 @@ void SCoreStartupParameter::LoadDefaults()
bCPUThread = false;
bSkipIdle = false;
bRunCompareServer = false;
bDSPHLE = true;
bDSPThread = true;
bLockThreads = true;
bEnableFPRF = false;
+1 -1
View File
@@ -69,6 +69,7 @@ struct SCoreStartupParameter
bool bCPUThread;
bool bDSPThread;
bool bDSPHLE;
bool bSkipIdle;
bool bNTSC;
bool bNTSCJ;
@@ -129,7 +130,6 @@ struct SCoreStartupParameter
// files
std::string m_strVideoPlugin;
std::string m_strDSPPlugin;
std::string m_strFilename;
std::string m_strBootROM;
+27 -20
View File
@@ -47,6 +47,7 @@
#include "../PowerPC/PowerPC.h"
#include "../PluginManager.h"
#include "../ConfigManager.h"
#include "../PluginDSP.h"
namespace DSP
{
@@ -60,8 +61,8 @@ enum
DSP_MAIL_FROM_DSP_LO = 0x5006,
DSP_CONTROL = 0x500A,
DSP_INTERRUPT_CONTROL = 0x5010,
AR_INFO = 0x5012, // These names are a good guess at best
AR_MODE = 0x5016, //
AR_INFO = 0x5012, // These names are a good guess at best
AR_MODE = 0x5016, //
AR_REFRESH = 0x501a,
AR_DMA_MMADDR_H = 0x5020,
AR_DMA_MMADDR_L = 0x5022,
@@ -71,7 +72,7 @@ enum
AR_DMA_CNT_L = 0x502A,
AUDIO_DMA_START_HI = 0x5030,
AUDIO_DMA_START_LO = 0x5032,
AUDIO_DMA_BLOCKS_LENGTH = 0x5034, // Ever used?
AUDIO_DMA_BLOCKS_LENGTH = 0x5034, // Ever used?
AUDIO_DMA_CONTROL_LEN = 0x5036,
AUDIO_DMA_BLOCKS_LEFT = 0x503A,
};
@@ -211,7 +212,7 @@ static ARAM_Info g_ARAM_Info;
static u16 g_AR_MODE;
static u16 g_AR_REFRESH;
Common::PluginDSP *dsp_plugin;
PluginDSP *dsp_plugin;
static int dsp_slice = 0;
static bool dsp_is_lle = false;
@@ -229,6 +230,8 @@ void DoState(PointerWrap &p)
p.Do(g_ARAM_Info);
p.Do(g_AR_MODE);
p.Do(g_AR_REFRESH);
dsp_plugin->DoState(p);
}
@@ -245,13 +248,15 @@ void GenerateDSPInterrupt_Wrapper(u64 userdata, int cyclesLate)
GenerateDSPInterrupt((DSPInterruptType)(userdata&0xFFFF), (bool)((userdata>>16) & 1));
}
void Init()
PluginDSP *GetPlugin()
{
dsp_plugin = CPluginManager::GetInstance().GetDSP();
PLUGIN_INFO DSPType;
dsp_plugin->GetInfo(DSPType);
std::string DSPName(DSPType.Name);
dsp_is_lle = (DSPName.find("LLE") != std::string::npos) || (DSPName.find("lle") != std::string::npos);
return dsp_plugin;
}
void Init(bool hle)
{
dsp_plugin = CreateDSPPlugin(hle);
dsp_is_lle = dsp_plugin->IsLLE();
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
@@ -263,7 +268,7 @@ void Init()
}
else
{
// On the GC, ARAM is accessible only through this interface (unless you're doing mmu tricks?...)
// On the GC, ARAM is accessible only through this interface.
g_ARAM.wii_mode = false;
g_ARAM.size = ARAM_SIZE;
g_ARAM.mask = ARAM_MASK;
@@ -288,6 +293,8 @@ void Shutdown()
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
g_ARAM.ptr = NULL;
dsp_plugin->Shutdown();
delete dsp_plugin;
dsp_plugin = NULL;
}
@@ -301,11 +308,11 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
dsp_plugin->DSP_Update(DSP_MAIL_SLICE);
dsp_slice -= DSP_MAIL_SLICE;
}
_uReturnValue = dsp_plugin->DSP_ReadMailboxHigh(true);
_uReturnValue = dsp_plugin->DSP_ReadMailBoxHigh(true);
break;
case DSP_MAIL_TO_DSP_LO:
_uReturnValue = dsp_plugin->DSP_ReadMailboxLow(true);
_uReturnValue = dsp_plugin->DSP_ReadMailBoxLow(true);
break;
case DSP_MAIL_FROM_DSP_HI:
@@ -313,11 +320,11 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
dsp_plugin->DSP_Update(DSP_MAIL_SLICE);
dsp_slice -= DSP_MAIL_SLICE;
}
_uReturnValue = dsp_plugin->DSP_ReadMailboxHigh(false);
_uReturnValue = dsp_plugin->DSP_ReadMailBoxHigh(false);
break;
case DSP_MAIL_FROM_DSP_LO:
_uReturnValue = dsp_plugin->DSP_ReadMailboxLow(false);
_uReturnValue = dsp_plugin->DSP_ReadMailBoxLow(false);
break;
case DSP_CONTROL:
@@ -382,11 +389,11 @@ void Write16(const u16 _Value, const u32 _Address)
{
// DSP
case DSP_MAIL_TO_DSP_HI:
dsp_plugin->DSP_WriteMailboxHigh(true, _Value);
dsp_plugin->DSP_WriteMailBoxHigh(true, _Value);
break;
case DSP_MAIL_TO_DSP_LO:
dsp_plugin->DSP_WriteMailboxLow(true, _Value);
dsp_plugin->DSP_WriteMailBoxLow(true, _Value);
break;
case DSP_MAIL_FROM_DSP_HI:
@@ -527,7 +534,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
{
// DSP
case DSP_MAIL_TO_DSP_HI:
_uReturnValue = (dsp_plugin->DSP_ReadMailboxHigh(true) << 16) | dsp_plugin->DSP_ReadMailboxLow(true);
_uReturnValue = (dsp_plugin->DSP_ReadMailBoxHigh(true) << 16) | dsp_plugin->DSP_ReadMailBoxLow(true);
break;
// AI
@@ -563,8 +570,8 @@ void Write32(const u32 _iValue, const u32 _iAddress)
{
// DSP
case DSP_MAIL_TO_DSP_HI:
dsp_plugin->DSP_WriteMailboxHigh(true, _iValue >> 16);
dsp_plugin->DSP_WriteMailboxLow(true, (u16)_iValue);
dsp_plugin->DSP_WriteMailBoxHigh(true, _iValue >> 16);
dsp_plugin->DSP_WriteMailBoxLow(true, (u16)_iValue);
break;
// AI
+5 -1
View File
@@ -20,6 +20,7 @@
#include "Common.h"
class PointerWrap;
class PluginDSP;
namespace DSP
{
@@ -38,8 +39,11 @@ enum
ARAM_MASK = 0x00FFFFFF,
};
void Init();
void Init(bool hle);
void Shutdown();
PluginDSP *GetPlugin();
void DoState(PointerWrap &p);
void GenerateDSPInterrupt(DSPInterruptType _DSPInterruptType, bool _bSet = true);
+229
View File
@@ -0,0 +1,229 @@
// Copyright (C) 2003 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 <iostream>
#include "DSPHLEGlobals.h" // Local
#include "ChunkFile.h"
#include "IniFile.h"
#include "HLEMixer.h"
#include "DSPHandler.h"
#include "Config.h"
#include "Setup.h"
#include "StringUtil.h"
#include "LogManager.h"
#include "IniFile.h"
#include "DSPHLE.h"
#include "../AudioInterface.h"
DSPHLE::DSPHLE() {
g_InitMixer = false;
soundStream = NULL;
}
// Mailbox utility
struct DSPState
{
u32 CPUMailbox;
u32 DSPMailbox;
void Reset() {
CPUMailbox = 0x00000000;
DSPMailbox = 0x00000000;
}
DSPState()
{
Reset();
}
};
DSPState g_dspState;
void DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
this->hWnd = hWnd;
this->bWii = bWii;
g_InitMixer = false;
g_dspState.Reset();
CDSPHandler::CreateInstance(bWii);
}
void DSPHLE::DSP_StopSoundStream()
{
}
void DSPHLE::Shutdown()
{
AudioCommon::ShutdownSoundStream();
// Delete the UCodes
CDSPHandler::Destroy();
}
void DSPHLE::DoState(PointerWrap &p)
{
p.Do(g_InitMixer);
CDSPHandler::GetInstance().GetUCode()->DoState(p);
}
void DSPHLE::EmuStateChange(PLUGIN_EMUSTATE newState)
{
DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true);
}
// Mailbox fuctions
unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return (g_dspState.CPUMailbox >> 16) & 0xFFFF;
}
else
{
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh();
}
}
unsigned short DSPHLE::DSP_ReadMailBoxLow(bool _CPUMailbox)
{
if (_CPUMailbox)
{
return g_dspState.CPUMailbox & 0xFFFF;
}
else
{
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow();
}
}
void DSPHLE::DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short _Value)
{
if (_CPUMailbox)
{
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
}
else
{
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
}
}
void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
{
if (_CPUMailbox)
{
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
// Mail sent so clear MSB to show that it is progressed
g_dspState.CPUMailbox &= 0x7FFFFFFF;
}
else
{
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
}
}
// Other DSP fuctions
unsigned short DSPHLE::DSP_WriteControlRegister(unsigned short _Value)
{
UDSPControl Temp(_Value);
if (!g_InitMixer)
{
if (!Temp.DSPHalt && Temp.DSPInit)
{
unsigned int AISampleRate, DACSampleRate, BackendSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
std::string frequency = ac_Config.sFrequency;
if (frequency == "48,000 Hz")
BackendSampleRate = 48000;
else
BackendSampleRate = 32000;
soundStream = AudioCommon::InitSoundStream(
new HLEMixer(AISampleRate, DACSampleRate, BackendSampleRate), hWnd);
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
g_InitMixer = true;
}
}
return CDSPHandler::GetInstance().WriteControlRegister(_Value);
}
unsigned short DSPHLE::DSP_ReadControlRegister()
{
return CDSPHandler::GetInstance().ReadControlRegister();
}
void DSPHLE::DSP_Update(int cycles)
{
// This is called OFTEN - better not do anything expensive!
// ~1/6th as many cycles as the period PPC-side.
CDSPHandler::GetInstance().Update(cycles / 6);
}
// The reason that we don't disable this entire
// function when Other Audio is disabled is that then we can't turn it back on
// again once the game has started.
void DSPHLE::DSP_SendAIBuffer(unsigned int address, unsigned int num_samples)
{
if (!soundStream)
return;
CMixer* pMixer = soundStream->GetMixer();
if (pMixer && address)
{
short* samples = (short*)HLEMemory_Get_Pointer(address);
// Internal sample rate is always 32khz
pMixer->PushSamples(samples, num_samples);
// FIXME: Write the audio to a file
//if (log_ai)
// g_wave_writer.AddStereoSamples(samples, 8);
}
soundStream->Update();
}
void DSPHLE::DSP_ClearAudioBuffer(bool mute)
{
if (soundStream)
soundStream->Clear(mute);
}
#define HLE_CONFIG_FILE "DSP.ini"
void DSPHLE_LoadConfig()
{
// first load defaults
IniFile file;
file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str());
ac_Config.Load(file);
}
void DSPHLE_SaveConfig()
{
IniFile file;
file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str());
ac_Config.Set(file);
file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + HLE_CONFIG_FILE).c_str());
}

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