Add an SPU2reset callback to SPU2 plugins, needed to put a stop to SPU2 sound generation when resetting the PS2 VM. If a plugin doesn't implement it directly, it automatically falls back on a manual soft reset using the SPU2's builtin software Core0/1 register writes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3575 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-07-27 03:41:18 +00:00
parent 0d029979ca
commit 8984e80c24
3 changed files with 16 additions and 7 deletions

View File

@ -344,6 +344,7 @@ void CALLBACK SPU2shutdown();
void CALLBACK SPU2setSettingsDir( const char* dir );
void CALLBACK SPU2setLogDir( const char* dir );
void CALLBACK SPU2reset();
void CALLBACK SPU2write(u32 mem, u16 value);
u16 CALLBACK SPU2read(u32 mem);
@ -589,11 +590,6 @@ typedef void (CALLBACK* _GSwriteCSR)(u32 value);
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
// Worthless crap function that returns GS plugin specific data via some
// undocumented void* to a struct. If any pad plugin actually relies on
// this info, it deserves to fail new newer pcsx2s. -- air
//typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
// PAD
typedef s32 (CALLBACK* _PADinit)(u32 flags);
typedef s32 (CALLBACK* _PADopen)(void *pDsp);
@ -607,9 +603,8 @@ typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
// SPU2
// NOTE: The read/write functions CANNOT use XMM/MMX regs
// If you want to use them, need to save and restore current ones
typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
typedef void (CALLBACK* _SPU2reset)();
typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
typedef u16 (CALLBACK* _SPU2read)(u32 mem);
@ -761,6 +756,7 @@ extern _PADqueryMtap PADqueryMtap;
// SPU2
extern _SPU2open SPU2open;
extern _SPU2reset SPU2reset;
extern _SPU2write SPU2write;
extern _SPU2read SPU2read;

View File

@ -60,10 +60,13 @@ void hwReset()
//memset(PS2MEM_HW+0x2000, 0, 0x0000e000);
psHu32(SBUS_F260) = 0x1D000060;
// i guess this is kinda a version, it's used by some bioses
psHu32(DMAC_ENABLEW) = 0x1201;
psHu32(DMAC_ENABLER) = 0x1201;
SPU2reset();
sifInit();
sprInit();

View File

@ -254,6 +254,7 @@ static void PAD_update( u32 padslot ) { }
// SPU2
_SPU2open SPU2open;
_SPU2write SPU2write;
_SPU2reset SPU2reset;
_SPU2read SPU2read;
#ifdef ENABLE_NEW_IOPDMA_SPU2
_SPU2dmaRead SPU2dmaRead;
@ -529,9 +530,18 @@ static const LegacyApi_OptMethod s_MethMessOpt_CDVD[] =
// ----------------------------------------------------------------------------
// SPU2 Mess!
// ----------------------------------------------------------------------------
// manualized reset that writes core reset registers of the SPU2 plugin:
static void CALLBACK SPU2_Reset()
{
SPU2write( 0x1f90019A, 1<<15 ); // core 0
SPU2write( 0x1f90059A, 1<<15 ); // core 1
}
static const LegacyApi_ReqMethod s_MethMessReq_SPU2[] =
{
{ "SPU2open", (vMeth**)&SPU2open, NULL },
{ "SPU2reset", (vMeth**)&SPU2reset, SPU2_Reset },
{ "SPU2write", (vMeth**)&SPU2write, NULL },
{ "SPU2read", (vMeth**)&SPU2read, NULL },
#ifdef ENABLE_NEW_IOPDMA_SPU2