fix for last commit

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2028 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-01-29 01:53:07 +00:00
parent 7219bcd4d5
commit a5e0bdb1ed
6 changed files with 200 additions and 192 deletions

View File

@ -119,11 +119,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_Wiimote", "Plugins\P
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} {C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_NULL", "Plugins\Plugin_DSP_NULL\Plugin_DSP_NULL.vcproj", "{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}"
ProjectSection(ProjectDependencies) = postProject
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL_Test", "Plugins\Plugin_nJoy_Testing\Plugin_nJoy_SDL_Test.vcproj", "{ADF64291-57ED-4B7A-AB76-37B4A991504B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL_Test", "Plugins\Plugin_nJoy_Testing\Plugin_nJoy_SDL_Test.vcproj", "{ADF64291-57ED-4B7A-AB76-37B4A991504B}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}
@ -376,18 +371,6 @@ Global
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Debug|Win32.ActiveCfg = Debug|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Debug|Win32.Build.0 = Debug|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Debug|x64.ActiveCfg = Debug|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Debug|x64.Build.0 = Debug|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.DebugFast|Win32.Build.0 = DebugFast|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.DebugFast|x64.ActiveCfg = DebugFast|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.DebugFast|x64.Build.0 = DebugFast|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|Win32.ActiveCfg = Release|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|Win32.Build.0 = Release|Win32
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|x64.ActiveCfg = Release|x64
{C6CC7A52-0FDD-433A-B2CF-9C6F187DA807}.Release|x64.Build.0 = Release|x64
{ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32
{ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.Build.0 = Debug|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.Build.0 = Debug|Win32
{ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.ActiveCfg = Debug|x64 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.ActiveCfg = Debug|x64
@ -425,17 +408,11 @@ Global
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.ActiveCfg = Release|x64 {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.ActiveCfg = Release|x64
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.Build.0 = Release|x64 {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.Build.0 = Release|x64
{58E81545-241B-416E-8088-E62452EB25FA}.Debug|Win32.ActiveCfg = Debug|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.Debug|Win32.ActiveCfg = Debug|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.Debug|Win32.Build.0 = Debug|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.Debug|x64.ActiveCfg = Debug|x64 {58E81545-241B-416E-8088-E62452EB25FA}.Debug|x64.ActiveCfg = Debug|x64
{58E81545-241B-416E-8088-E62452EB25FA}.Debug|x64.Build.0 = Debug|x64
{58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|Win32.Build.0 = DebugFast|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|x64.ActiveCfg = DebugFast|x64 {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|x64.ActiveCfg = DebugFast|x64
{58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|x64.Build.0 = DebugFast|x64
{58E81545-241B-416E-8088-E62452EB25FA}.Release|Win32.ActiveCfg = Release|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.Release|Win32.ActiveCfg = Release|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.Release|Win32.Build.0 = Release|Win32
{58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.ActiveCfg = Release|x64 {58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.ActiveCfg = Release|x64
{58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -69,7 +69,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib Rpcrt4.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib Rpcrt4.lib comctl32.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLED.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -154,7 +154,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib Rpcrt4.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib Rpcrt4.lib comctl32.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -242,7 +242,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -420,7 +420,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -509,7 +509,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLEDF.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"

View File

@ -57,6 +57,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
m_buttonEnableThrottle->SetToolTip(wxT("This is sometimes used together with pre-rendered movies.\n" m_buttonEnableThrottle->SetToolTip(wxT("This is sometimes used together with pre-rendered movies.\n"
"Disabling this also disables the speed throttle which this causes,\n" "Disabling this also disables the speed throttle which this causes,\n"
"meaning that there will be no upper limit on your FPS.")); "meaning that there will be no upper limit on your FPS."));
m_BackendSelection->SetToolTip(wxT("Changing this will have no effect while the emulator is running!"));
// Create sizer and add items to dialog // Create sizer and add items to dialog
wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);

View File

@ -0,0 +1,30 @@
// Copyright (C) 2003-2009 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// 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 __NULLSOUNDSTREAM_H__
#define __NULLSOUNDSTREAM_H__
#include "SoundStream.h"
class NullSound : public SoundStream
{
public:
NullSound(int _sampleRate, StreamCallback _callback, void *hWnd = NULL) :
SoundStream(_sampleRate, _callback) {}
};
#endif //__NULLSOUNDSTREAM_H__

View File

@ -12,11 +12,11 @@ files = [
'Config.cpp', 'Config.cpp',
'Globals.cpp', 'Globals.cpp',
'PCHW/AOSoundStream.cpp', 'PCHW/AOSoundStream.cpp',
# 'PCHW/NullSoundStream.cpp', 'PCHW/NullSoundStream.cpp',
'PCHW/Mixer.cpp', 'PCHW/Mixer.cpp',
'Debugger/File.cpp', 'Debugger/File.cpp',
'UCodes/UCode_AX.cpp', 'UCodes/UCode_AX.cpp',
'UCodes/UCode_AXWii.cpp', 'UCodes/UCode_AXWii.cpp',
'UCodes/UCode_CARD.cpp', 'UCodes/UCode_CARD.cpp',
'UCodes/UCode_InitAudioSystem.cpp', 'UCodes/UCode_InitAudioSystem.cpp',
'UCodes/UCode_Jac.cpp', 'UCodes/UCode_Jac.cpp',

View File

@ -54,22 +54,22 @@ static WaveFileWriter g_wave_writer;
// Mailbox utility // Mailbox utility
struct DSPState struct DSPState
{ {
u32 CPUMailbox; u32 CPUMailbox;
bool CPUMailbox_Written[2]; bool CPUMailbox_Written[2];
u32 DSPMailbox; u32 DSPMailbox;
bool DSPMailbox_Read[2]; bool DSPMailbox_Read[2];
DSPState() DSPState()
{ {
CPUMailbox = 0x00000000; CPUMailbox = 0x00000000;
CPUMailbox_Written[0] = false; CPUMailbox_Written[0] = false;
CPUMailbox_Written[1] = false; CPUMailbox_Written[1] = false;
DSPMailbox = 0x00000000; DSPMailbox = 0x00000000;
DSPMailbox_Read[0] = true; DSPMailbox_Read[0] = true;
DSPMailbox_Read[1] = true; DSPMailbox_Read[1] = true;
} }
}; };
DSPState g_dspState; DSPState g_dspState;
@ -77,10 +77,10 @@ DSPState g_dspState;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp class wxDLLApp : public wxApp
{ {
bool OnInit() bool OnInit()
{ {
return true; return true;
} }
}; };
IMPLEMENT_APP_NO_MAIN(wxDLLApp) IMPLEMENT_APP_NO_MAIN(wxDLLApp)
@ -92,36 +92,36 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved LPVOID lpvReserved) // reserved
{ {
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
{ {
// more stuff wx needs // more stuff wx needs
wxSetInstance((HINSTANCE)hinstDLL); wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0; int argc = 0;
char **argv = NULL; char **argv = NULL;
wxEntryStart(argc, argv); wxEntryStart(argc, argv);
// This is for ? // This is for ?
if ( !wxTheApp || !wxTheApp->CallOnInit() ) if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); // use this or get a crash wxEntryCleanup(); // use this or get a crash
break; break;
default: default:
break; break;
} }
g_hInstance = hinstDLL; g_hInstance = hinstDLL;
return(TRUE); return(TRUE);
} }
#endif #endif
@ -130,17 +130,17 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
void OpenConsole() void OpenConsole()
{ {
#if defined (_WIN32) #if defined (_WIN32)
Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
Console::Print("OpenConsole > Console opened\n"); Console::Print("OpenConsole > Console opened\n");
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
// adjustable from the debugging window // adjustable from the debugging window
#endif #endif
} }
void CloseConsole() void CloseConsole()
{ {
#if defined (_WIN32) #if defined (_WIN32)
FreeConsole(); FreeConsole();
#endif #endif
} }
@ -154,18 +154,18 @@ void DllDebugger(HWND _hParent, bool Show)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_frame && Show) // if we have created it, let us show it again if(m_frame && Show) // if we have created it, let us show it again
{ {
m_frame->DoShow(); m_frame->DoShow();
} }
else if(!m_frame && Show) else if(!m_frame && Show)
{ {
m_frame = new CDebugger(NULL); m_frame = new CDebugger(NULL);
m_frame->Show(); m_frame->Show();
} }
else if(m_frame && !Show) else if(m_frame && !Show)
{ {
m_frame->DoHide(); m_frame->DoHide();
} }
#endif #endif
} }
@ -173,15 +173,15 @@ void DllDebugger(HWND _hParent, bool Show)
void GetDllInfo(PLUGIN_INFO* _PluginInfo) void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP; _PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) "); sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) ");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin "); sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin ");
#else #else
sprintf(_PluginInfo ->Name, "Dolphin DSP-HLE Plugin (Debug) "); sprintf(_PluginInfo ->Name, "Dolphin DSP-HLE Plugin (Debug) ");
#endif #endif
#endif #endif
} }
@ -192,207 +192,207 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// (shuffle2) TODO: reparent dlg with DolphinApp // (shuffle2) TODO: reparent dlg with DolphinApp
ConfigDialog dlg(NULL); ConfigDialog dlg(NULL);
if (DSound::isValid()) if (DSound::isValid())
dlg.AddBackend("DSound"); dlg.AddBackend("DSound");
if (AOSound::isValid()) if (AOSound::isValid())
dlg.AddBackend("AOSound"); dlg.AddBackend("AOSound");
dlg.AddBackend("NullSound"); dlg.AddBackend("NullSound");
dlg.ShowModal(); dlg.ShowModal();
#endif #endif
} }
void Initialize(void *init) void Initialize(void *init)
{ {
g_Config.Load(); g_Config.Load();
g_dspInitialize = *(DSPInitialize*)init; g_dspInitialize = *(DSPInitialize*)init;
g_pMemory = g_dspInitialize.pGetMemoryPointer(0); g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
gpName = g_dspInitialize.pName(); // save the game name globally gpName = g_dspInitialize.pName(); // save the game name globally
for (u32 i = 0; i < gpName.length(); ++i) // and fix it for (u32 i = 0; i < gpName.length(); ++i) // and fix it
{ {
fprintf(stderr,"%c", gpName[i]); fprintf(stderr,"%c", gpName[i]);
std::cout << gpName[i]; std::cout << gpName[i];
if (gpName[i] == ':') gpName[i] = ' '; if (gpName[i] == ':') gpName[i] = ' ';
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
#endif #endif
CDSPHandler::CreateInstance(); CDSPHandler::CreateInstance();
if (strncasecmp(g_Config.sBackend, "DSound", 10) == 0) { if (strncasecmp(g_Config.sBackend, "DSound", 10) == 0) {
if (DSound::isValid()) { if (DSound::isValid()) {
soundStream = new DSound(48000, Mixer, g_dspInitialize.hWnd); soundStream = new DSound(48000, Mixer, g_dspInitialize.hWnd);
}
} else if(strncasecmp(g_Config.sBackend, "AOSound", 10) == 0) {
if (AOSound::isValid())
soundStream = new AOSound(48000, Mixer);
} else if(strncasecmp(g_Config.sBackend, "NullSound", 10) == 0) {
soundStream = new NullSound(48000, Mixer);
} else {
PanicAlert("Cannot recognize backend %s", g_Config.sBackend);
return;
} }
} else if(strncasecmp(g_Config.sBackend, "AOSound", 10) == 0) {
if (AOSound::isValid())
soundStream = new AOSound(48000, Mixer);
} else if(strncasecmp(g_Config.sBackend, "NullSound", 10) == 0) {
soundStream = new NullSound(48000, Mixer);
} else {
PanicAlert("Cannot recognize backend %s", g_Config.sBackend);
return;
}
#if defined(WIN32) && defined(_DEBUG) #if defined(WIN32) && defined(_DEBUG)
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF; tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
_CrtSetDbgFlag(tmpflag); _CrtSetDbgFlag(tmpflag);
#endif #endif
if (soundStream) { if (soundStream) {
if(!soundStream->Start()) { if(!soundStream->Start()) {
PanicAlert("Could not initialize backend %s, falling back to NULL", PanicAlert("Could not initialize backend %s, falling back to NULL",
g_Config.sBackend); g_Config.sBackend);
delete soundStream; delete soundStream;
soundStream = new NullSound(48000, Mixer); soundStream = new NullSound(48000, Mixer);
soundStream->Start(); soundStream->Start();
}
} else {
PanicAlert("Sound backend %s is not valid, falling back to NULL",
g_Config.sBackend);
delete soundStream;
soundStream = new NullSound(48000, Mixer);
soundStream->Start();
} }
} else {
PanicAlert("Sound backend %s is not valid, falling back to NULL",
g_Config.sBackend);
delete soundStream;
soundStream = new NullSound(48000, Mixer);
soundStream->Start();
}
} }
void Shutdown() void Shutdown()
{ {
if (log_ai) if (log_ai)
g_wave_writer.Stop(); g_wave_writer.Stop();
// delete the UCodes // delete the UCodes
soundStream->Stop(); soundStream->Stop();
delete soundStream; delete soundStream;
soundStream = NULL; soundStream = NULL;
CDSPHandler::Destroy(); CDSPHandler::Destroy();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// Reset mails // Reset mails
if(m_frame) if(m_frame)
{ {
sMailLog.clear(); sMailLog.clear();
sMailTime.clear(); sMailTime.clear();
m_frame->sMail.clear(); m_frame->sMail.clear();
m_frame->sMailEnd.clear(); m_frame->sMailEnd.clear();
} }
#endif #endif
} }
void DoState(unsigned char **ptr, int mode) { void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode); PointerWrap p(ptr, mode);
} }
// Mailbox fuctions // Mailbox fuctions
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox) unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{ {
if (_CPUMailbox) if (_CPUMailbox)
{ {
return (g_dspState.CPUMailbox >> 16) & 0xFFFF; return (g_dspState.CPUMailbox >> 16) & 0xFFFF;
} }
else else
{ {
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh(); return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh();
} }
} }
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox) unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
{ {
if (_CPUMailbox) if (_CPUMailbox)
{ {
return g_dspState.CPUMailbox & 0xFFFF; return g_dspState.CPUMailbox & 0xFFFF;
} }
else else
{ {
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow(); return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow();
} }
} }
void Update_DSP_WriteRegister() void Update_DSP_WriteRegister()
{ {
// check if the whole message is complete and if we can send it // check if the whole message is complete and if we can send it
if (g_dspState.CPUMailbox_Written[0] && g_dspState.CPUMailbox_Written[1]) if (g_dspState.CPUMailbox_Written[0] && g_dspState.CPUMailbox_Written[1])
{ {
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox); CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
g_dspState.CPUMailbox_Written[0] = g_dspState.CPUMailbox_Written[1] = false; 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 g_dspState.CPUMailbox = 0; // Mail sent so clear it to show that it is progressed
} }
} }
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value) void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value)
{ {
if (_CPUMailbox) if (_CPUMailbox)
{ {
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16); g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
g_dspState.CPUMailbox_Written[0] = true; g_dspState.CPUMailbox_Written[0] = true;
Update_DSP_WriteRegister(); Update_DSP_WriteRegister();
} }
else else
{ {
PanicAlert("CPU can't write %08x to DSP mailbox", _Value); PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
} }
} }
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value) void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value)
{ {
if (_CPUMailbox) if (_CPUMailbox)
{ {
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value; g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
g_dspState.CPUMailbox_Written[1] = true; g_dspState.CPUMailbox_Written[1] = true;
Update_DSP_WriteRegister(); Update_DSP_WriteRegister();
} }
else else
{ {
PanicAlert("CPU can't write %08x to DSP mailbox", _Value); PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
} }
} }
// Other DSP fuctions // Other DSP fuctions
unsigned short DSP_WriteControlRegister(unsigned short _Value) unsigned short DSP_WriteControlRegister(unsigned short _Value)
{ {
return CDSPHandler::GetInstance().WriteControlRegister(_Value); return CDSPHandler::GetInstance().WriteControlRegister(_Value);
} }
unsigned short DSP_ReadControlRegister() unsigned short DSP_ReadControlRegister()
{ {
return CDSPHandler::GetInstance().ReadControlRegister(); return CDSPHandler::GetInstance().ReadControlRegister();
} }
void DSP_Update(int cycles) void DSP_Update(int cycles)
{ {
CDSPHandler::GetInstance().Update(); CDSPHandler::GetInstance().Update();
} }
void DSP_SendAIBuffer(unsigned int address, int sample_rate) void DSP_SendAIBuffer(unsigned int address, int sample_rate)
{ {
if(soundStream->usesMixer()) { if(soundStream->usesMixer()) {
short samples[16] = {0}; // interleaved stereo short samples[16] = {0}; // interleaved stereo
if (address) { if (address) {
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
samples[i] = Memory_Read_U16(address + i * 2); samples[i] = Memory_Read_U16(address + i * 2);
} }
if (log_ai) if (log_ai)
g_wave_writer.AddStereoSamples(samples, 8); g_wave_writer.AddStereoSamples(samples, 8);
}
Mixer_PushSamples(samples, 32 / 4, sample_rate);
} }
Mixer_PushSamples(samples, 32 / 4, sample_rate);
}
/*static int counter = 0; /*static int counter = 0;
counter++; counter++;
if ((counter & 255) == 0)*/ if ((counter & 255) == 0)*/
// SoundStream is updated only when necessary (there is no 70 ms limit // SoundStream is updated only when necessary (there is no 70 ms limit
// so each sample now triggers the sound stream) // so each sample now triggers the sound stream)
soundStream->Update(); soundStream->Update();
} }