From a2d4144ce9c79cd7a153616da2080552f76bf1e3 Mon Sep 17 00:00:00 2001
From: "Jake.Stine" <Jake.Stine@96395faa-99c1-11dd-bbfe-3dabce05a288>
Date: Thu, 17 Sep 2009 02:12:32 +0000
Subject: [PATCH] Linux: Fix some of the standard issue compiler errors that
 come with any changes. :)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1836 96395faa-99c1-11dd-bbfe-3dabce05a288
---
 common/include/Utilities/HashMap.h        | 12 ++--
 pcsx2/MTGS.cpp                            | 40 ++++++-------
 pcsx2/RecoverySystem.cpp                  |  8 +--
 pcsx2/System.cpp                          | 16 +++---
 pcsx2/gui/App.h                           | 10 ++--
 pcsx2/gui/Dialogs/ConfigurationDialog.cpp | 12 ++--
 pcsx2/gui/Dialogs/ConfigurationDialog.h   | 10 ++--
 pcsx2/gui/wxHelpers.cpp                   |  4 +-
 plugins/spu2-x/src/Mixer.cpp              | 70 ++++++++++++-----------
 9 files changed, 96 insertions(+), 86 deletions(-)

diff --git a/common/include/Utilities/HashMap.h b/common/include/Utilities/HashMap.h
index dd1aa22ef5..90f0851564 100644
--- a/common/include/Utilities/HashMap.h
+++ b/common/include/Utilities/HashMap.h
@@ -550,8 +550,13 @@ template< class Key, class T >
 class HashMap : public google::dense_hash_map<Key, T, CommonHashClass>
 {
 public:
-	using dense_hash_map<Key, T, CommonHashClass>::operator[];
-	using dense_hash_map<Key, T, CommonHashClass>::const_iterator;
+#ifndef _MSC_VER
+	typedef typename google::dense_hash_map<Key, T, CommonHashClass> __super;
+#endif
+
+	using __super::operator[];
+	using __super::end;
+	typedef typename __super::const_iterator const_iterator;
 
 	virtual ~HashMap() {}
 
@@ -579,8 +584,7 @@ public:
 	/// </remarks>
 	void TryGetValue( const Key& key, T& outval ) const
 	{
-		// See above class for notes on why this is commented out.
-		const_iterator iter = find( key );
+		const_iterator iter( find(key) );
 		if( iter != end() )
 			outval = iter->second;
 	}
diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp
index b51d3aa4ca..86194a130f 100644
--- a/pcsx2/MTGS.cpp
+++ b/pcsx2/MTGS.cpp
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -104,10 +104,10 @@ static void RegHandlerSIGNAL(const u32* data)
 	MTGS_LOG("MTGS SIGNAL data %x_%x CSRw %x IMR %x CSRr\n",data[0], data[1], CSRw, GSIMR, GSCSRr);
 
 	GSSIGLBLID->SIGID = (GSSIGLBLID->SIGID&~data[1])|(data[0]&data[1]);
-	
+
 	if ((CSRw & 0x1))
 	{
-		if (!(GSIMR&0x100) )  
+		if (!(GSIMR&0x100) )
 		{
 			gsIrq();
 		}
@@ -198,7 +198,7 @@ void mtgsThreadObject::Start()
 		throw Exception::PluginOpenError( PluginId_GS );
 }
 
-mtgsThreadObject::~mtgsThreadObject()
+mtgsThreadObject::~mtgsThreadObject() throw()
 {
 	mtgsThreadObject::Cancel();
 }
@@ -209,7 +209,7 @@ void mtgsThreadObject::Cancel()
 {
 	//SendSimplePacket( GS_RINGTYPE_QUIT, 0, 0, 0 );
 	//SetEvent();
-	//m_sem_finished.WaitGui();	
+	//m_sem_finished.WaitGui();
 	PersistentThread::Cancel();
 }
 
@@ -236,7 +236,7 @@ void mtgsThreadObject::Reset()
 }
 #define subVal(x) ((x) ? (x-1) : 0)
 
-__forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8* pMem, u32 size) 
+__forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8* pMem, u32 size)
 {
 	GIFPath& path		= m_path[pathidx];
 	u32 finish			= (pathidx == GIF_PATH_1) ? 0x4000 : (size<<4);
@@ -259,7 +259,7 @@ __forceinline int mtgsThreadObject::_gifTransferDummy(GIF_PATH pathidx, const u8
 		oldSize		 = size;
 		numRegs		 = ((path.tag.nreg-1)&0xf)+1;
 		EOP			 = ((pathidx == GIF_PATH_2) ? 0 : path.tag.eop);
-		
+
 		if (!path.tag.nloop || size >= finish) continue;
 
 		switch(path.tag.flg) {
@@ -335,8 +335,8 @@ __forceinline int mtgsThreadObject::gifTransferDummy(GIF_PATH pathidx, const u8*
 	static uptr profStartPtr = 0;
 	static uptr profEndPtr = 0;
 	if (profStartPtr == 0) {
-		__asm 
-		{ 
+		__asm
+		{
 	__beginfunc:
 			mov profStartPtr, offset __beginfunc;
 			mov profEndPtr, offset __endfunc;
@@ -348,7 +348,7 @@ __forceinline int mtgsThreadObject::gifTransferDummy(GIF_PATH pathidx, const u8*
 	int retSize = _gifTransferDummy(pathidx, pMem, size);
 
 #ifdef PCSX2_GSRING_SAMPLING_STATS
-	__asm 
+	__asm
 	{
 		__endfunc:
 				nop;
@@ -436,8 +436,8 @@ void mtgsThreadObject::_RingbufferLoop()
 			{
 				case GS_RINGTYPE_RESTART:
 					AtomicExchange(m_RingPos, 0);
-					
-					// stall for a bit to let the MainThread have time to update the g_pGSWritePos. 
+
+					// stall for a bit to let the MainThread have time to update the g_pGSWritePos.
 					m_lock_RingRestart.Lock();
 					m_lock_RingRestart.Unlock();
 				continue;
@@ -680,12 +680,12 @@ void mtgsThreadObject::SendDataPacket()
 	{
 		// The ringbuffer is current in a resting state, so if enough copies have
 		// queued up then go ahead and initiate the GS thread..
-		
+
 		// Optimization notes:  What we're doing here is initiating a "burst" mode on
 		// the thread, which improves its cache hit performance and makes it more friendly
-		// to other threads in Pcsx2 and such.  Primary is the Command Tally, and then a 
+		// to other threads in Pcsx2 and such.  Primary is the Command Tally, and then a
 		// secondary data size threshold for games that do lots of texture swizzling.
-		
+
 		// 16 was the best value I found so far.
 		// tested values:
 		//  24 - very slow on HT machines (+5% drop in fps)
@@ -736,7 +736,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
 	ringtx_s_max = max(ringtx_s_max,size);
 	ringtx_c++;
 	u32 tx_sz;
-	
+
 	if (_BitScanReverse(&tx_sz,size))
 	{
 		u32 tx_algn;
@@ -779,7 +779,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
 	// is reading it.
 
 	uint writepos = m_WritePos;
-	
+
 	// Checks if a previous copy was started without an accompanying call to GSRINGBUF_DONECOPY
 	jASSUME( m_packet_size == 0 );
 
@@ -803,7 +803,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
 			// readpos is out past the end of the future write pos, or until it wraps
 			// around (in which case writepos will be >= readpos)
 
-			PrepEventWait(); 
+			PrepEventWait();
 			while( true )
 			{
 				uint readpos = volatize(m_RingPos);
@@ -820,7 +820,7 @@ int mtgsThreadObject::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 s
 		// the start of the ring buffer (it's a lot easier than trying
 		// to wrap the packet around the end of the buffer).
 
-		// We have to be careful not to leapfrog our read-position.  If it's 
+		// We have to be careful not to leapfrog our read-position.  If it's
 		// greater than the current write position then we need to stall
 		// until it loops around to the beginning of the buffer
 
@@ -958,7 +958,7 @@ void mtgsThreadObject::SendPointerPacket( GS_RINGTYPE type, u32 data0, void* dat
 	tag.data[0] = data0;
 	*(uptr*)&tag.data[1] = (uptr)data1;
 
-	_FinishSimplePacket( thefuture );	
+	_FinishSimplePacket( thefuture );
 }
 
 // Waits for the GS to empty out the entire ring buffer contents.
diff --git a/pcsx2/RecoverySystem.cpp b/pcsx2/RecoverySystem.cpp
index 34fbce2aef..17e2049fcd 100644
--- a/pcsx2/RecoverySystem.cpp
+++ b/pcsx2/RecoverySystem.cpp
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -19,7 +19,7 @@
 #include "App.h"
 #include "HostGui.h"
 
-static wxScopedPtr<SafeArray<u8>> g_RecoveryState;
+static wxScopedPtr< SafeArray<u8> > g_RecoveryState;
 
 namespace StateRecovery {
 
@@ -53,7 +53,7 @@ namespace StateRecovery {
 	{
 		SaveToFile( SaveStateBase::GetFilename( num ) );
 	}
-	
+
 	// Creates a full recovery of the entire emulation state (CPU and all plugins).
 	// If a current recovery state is already present, then nothing is done (the
 	// existing recovery state takes precedence since if it were out-of-date it'd be
@@ -62,7 +62,7 @@ namespace StateRecovery {
 	{
 		if( g_RecoveryState ) return;
 		if( !EmulationInProgress() ) return;
-		
+
 		try
 		{
 			g_RecoveryState.reset( new SafeArray<u8>( L"Memory Savestate Recovery" ) );
diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp
index 496a2909e5..f2464b2ed9 100644
--- a/pcsx2/System.cpp
+++ b/pcsx2/System.cpp
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -12,7 +12,7 @@
  *  You should have received a copy of the GNU General Public License along with PCSX2.
  *  If not, see <http://www.gnu.org/licenses/>.
  */
- 
+
 #include "PrecompiledHeader.h"
 
 #include "HostGui.h"
@@ -73,9 +73,9 @@ void SysDetect()
 			x86caps.Flags, x86caps.Flags2,
 			x86caps.EFlags
 	) );
-	
+
 	wxArrayString features[2];	// 2 lines, for readability!
-	
+
 	if( x86caps.hasMultimediaExtensions )			features[0].Add( L"MMX" );
 	if( x86caps.hasStreamingSIMDExtensions )		features[0].Add( L"SSE" );
 	if( x86caps.hasStreamingSIMD2Extensions )		features[0].Add( L"SSE2" );
@@ -93,7 +93,7 @@ void SysDetect()
 	JoinString( result[0], features[0], L".. " );
 	JoinString( result[1], features[1], L".. " );
 
-	WriteLn( L"Features Detected:\n\t" + result[0] + (result[1].IsEmpty() ? wxEmptyString : (L"\n\t" + result[1])) + L"\n" );
+	WriteLn( L"Features Detected:\n\t" + result[0] + (result[1].IsEmpty() ? L"" : (L"\n\t" + result[1])) + L"\n" );
 
 	//if ( x86caps.VendorName[0] == 'A' ) //AMD cpu
 
@@ -117,7 +117,7 @@ EmuCoreAllocations::EmuCoreAllocations()
 	RecSuccess_IOP		= false;
 	RecSuccess_VU0		= false;
 	RecSuccess_VU1		= false;
-	
+
 	try
 	{
 		vtlb_Core_Alloc();
@@ -174,7 +174,7 @@ EmuCoreAllocations::EmuCoreAllocations()
 	}
 
 	// hmm! : VU0 and VU1 pre-allocations should do sVU and mVU separately?  Sounds complicated. :(
-	
+
 	try
 	{
 		VU0micro::recAlloc();
@@ -197,7 +197,7 @@ EmuCoreAllocations::EmuCoreAllocations()
 		VU1micro::recShutdown();
 	}
 
-	// If both VUrecs failed, then make sure the SuperVU is totally closed out, because it 
+	// If both VUrecs failed, then make sure the SuperVU is totally closed out, because it
 	// actually initializes everything once and then shares it between both VU recs.
 	if( !RecSuccess_VU0 && !RecSuccess_VU1 )
 		SuperVUDestroy( -1 );
diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h
index f68bc871bc..1862fe2221 100644
--- a/pcsx2/gui/App.h
+++ b/pcsx2/gui/App.h
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -265,7 +265,7 @@ public:
 	void Ping() const;
 
 	bool PrepForExit();
-	
+
 	// Executes the emulator using a saved/existing virtual machine state and currently
 	// configured CDVD source device.
 	// Debug assertions:
@@ -283,7 +283,7 @@ public:
 		if( !m_CoreThread ) return;
 		m_CoreThread->Suspend();
 	}
-	
+
 	void SysReset()
 	{
 		m_CoreThread.reset();
@@ -394,7 +394,7 @@ protected:
 
 public:
 	AppEmuThread( PluginManager& plugins );
-	virtual ~AppEmuThread() { }
+	virtual ~AppEmuThread() throw() { }
 
 	virtual void Resume();
 	virtual void StateCheck();
@@ -414,7 +414,7 @@ public:
 
 	virtual ~EntryGuard() throw()
 	{ --Counter; }
-	
+
 	bool IsReentrant() const { return Counter > 1; }
 };
 
diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
index 0bd6a9596c..e4bb328b78 100644
--- a/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
+++ b/pcsx2/gui/Dialogs/ConfigurationDialog.cpp
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -68,10 +68,10 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
 	AddPage<GameFixesPanel>		( wxLt("Game Fixes"),	cfgid.Gamefixes );
 	AddPage<PluginSelectorPanel>( wxLt("Plugins"),		cfgid.Plugins );
 	AddPage<StandardPathsPanel>	( wxLt("Folders"),		cfgid.Paths );
-	
+
 	mainSizer.Add( &m_listbook );
 	AddOkCancel( mainSizer, true );
-	
+
 	FindWindow( wxID_APPLY )->Disable();
 
 	SetSizerAndFit( &mainSizer );
@@ -109,7 +109,7 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
 	ConnectSomethingChanged( DIRPICKER_CHANGED );
 }
 
-Dialogs::ConfigurationDialog::~ConfigurationDialog()
+Dialogs::ConfigurationDialog::~ConfigurationDialog() throw()
 {
 	g_ApplyState.DoCleanup();
 }
@@ -148,9 +148,9 @@ Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent, int id ) :
 	wxDialogWithHelpers( parent, id, _("BIOS Selector"), false )
 {
 	wxBoxSizer& bleh( *new wxBoxSizer( wxVERTICAL ) );
-	
+
 	Panels::BaseSelectorPanel* selpan = new Panels::BiosSelectorPanel( *this, 500 );
-	
+
 	bleh.Add( selpan, SizerFlags::StdExpand() );
 	AddOkCancel( bleh, false );
 
diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.h b/pcsx2/gui/Dialogs/ConfigurationDialog.h
index 0c8830f5e8..7cd5e3965f 100644
--- a/pcsx2/gui/Dialogs/ConfigurationDialog.h
+++ b/pcsx2/gui/Dialogs/ConfigurationDialog.h
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -32,7 +32,7 @@ namespace Dialogs
 		wxArrayString	m_labels;
 
 	public:
-		virtual ~ConfigurationDialog();
+		virtual ~ConfigurationDialog() throw();
 		ConfigurationDialog(wxWindow* parent=NULL, int id=DialogId_CoreSettings);
 
 	protected:
@@ -52,14 +52,14 @@ namespace Dialogs
 			}
 		}
 	};
-	
-	
+
+
 	class BiosSelectorDialog : public wxDialogWithHelpers
 	{
 	protected:
 
 	public:
-		virtual ~BiosSelectorDialog() {}
+		virtual ~BiosSelectorDialog()  throw() {}
 		BiosSelectorDialog( wxWindow* parent=NULL, int id=DialogId_BiosSelector );
 
 	protected:
diff --git a/pcsx2/gui/wxHelpers.cpp b/pcsx2/gui/wxHelpers.cpp
index 9fac1d5ded..59f6e58c22 100644
--- a/pcsx2/gui/wxHelpers.cpp
+++ b/pcsx2/gui/wxHelpers.cpp
@@ -1,6 +1,6 @@
 /*  PCSX2 - PS2 Emulator for PCs
  *  Copyright (C) 2002-2009  PCSX2 Dev Team
- * 
+ *
  *  PCSX2 is free software: you can redistribute it and/or modify it under the terms
  *  of the GNU Lesser General Public License as published by the Free Software Found-
  *  ation, either version 3 of the License, or (at your option) any later version.
@@ -301,7 +301,7 @@ wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id,  const wxStr
 	// any good.
 }
 
-wxDialogWithHelpers::~wxDialogWithHelpers()
+wxDialogWithHelpers::~wxDialogWithHelpers() throw()
 {
 	--m_DialogIdents[GetId()];
 	wxASSERT( m_DialogIdents[GetId()] >= 0 );
diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp
index dd5f0dc560..fb41dfb818 100644
--- a/plugins/spu2-x/src/Mixer.cpp
+++ b/plugins/spu2-x/src/Mixer.cpp
@@ -1,6 +1,6 @@
 /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
  * Developed and maintained by the Pcsx2 Development Team.
- * 
+ *
  * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
  *
  * SPU2-X is free software: you can redistribute it and/or modify it under the terms
@@ -45,14 +45,17 @@ static const s32 tbl_XA_Factor[5][2] =
 //   caller to  extend the inputs so that they make use of all 32 bits of
 //   precision.
 //
-__forceinline s32 MulShr32( s32 srcval, s32 mulval )
+#ifdef MSC_VER
+__forceinline		// gcc can't inline this function, presumably because of it's exceeding complexity?
+#endif
+s32 MulShr32( s32 srcval, s32 mulval )
 {
 	s64 tmp = ((s64)srcval * mulval );
-	return ((s32*)&tmp)[1];
 
 	// Performance note: Using the temp var and memory reference
 	// actually ends up being roughly 2x faster than using a bitshift.
 	// It won't fly on big endian machines though... :)
+	return ((s32*)&tmp)[1];
 }
 
 __forceinline s32 clamp_mix( s32 x, u8 bitshift )
@@ -60,9 +63,12 @@ __forceinline s32 clamp_mix( s32 x, u8 bitshift )
 	return GetClamped( x, -0x8000<<bitshift, 0x7fff<<bitshift );
 }
 
-__forceinline StereoOut32 clamp_mix( const StereoOut32& sample, u8 bitshift )
+#if _MSC_VER
+__forceinline		// gcc forceinline fails here... ?
+#endif
+StereoOut32 clamp_mix( const StereoOut32& sample, u8 bitshift )
 {
-	return StereoOut32( 
+	return StereoOut32(
 		GetClamped( sample.Left, -0x8000<<bitshift, 0x7fff<<bitshift ),
 		GetClamped( sample.Right, -0x8000<<bitshift, 0x7fff<<bitshift )
 	);
@@ -145,9 +151,9 @@ static void __forceinline IncrementNextA( const V_Core& thiscore, V_Voice& vc )
 	for( int i=0; i<2; i++ )
 	{
 		if( Cores[i].IRQEnable && (vc.NextA==Cores[i].IRQA ) )
-		{ 
+		{
 			if( IsDevBuild )
-				ConLog(" * SPU2 Core %d: IRQ Called (IRQ passed).\n", i); 
+				ConLog(" * SPU2 Core %d: IRQ Called (IRQ passed).\n", i);
 
 			Spdif.Info = 4 << i;
 			SetIrqCall();
@@ -171,7 +177,7 @@ int g_counter_cache_ignores = 0;
 #define XAFLAG_LOOP			(1ul<<1)
 #define XAFLAG_LOOP_START	(1ul<<2)
 
-static __forceinline s32 __fastcall GetNextDataBuffered( V_Core& thiscore, uint voiceidx ) 
+static __forceinline s32 __fastcall GetNextDataBuffered( V_Core& thiscore, uint voiceidx )
 {
 	V_Voice& vc( thiscore.Voices[voiceidx] );
 
@@ -252,7 +258,7 @@ static __forceinline s32 __fastcall GetNextDataBuffered( V_Core& thiscore, uint
 		vc.SCurrent = 0;
 		if( (vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode )
 			vc.LoopStartA = vc.NextA;
-			
+
 		goto _Increment;
 	}
 
@@ -272,10 +278,10 @@ static s32 __forceinline GetNoiseValues()
 {
 	static s32 Seed = 0x41595321;
 	s32 retval = 0x8000;
-	
-	if( Seed&0x100 ) 
+
+	if( Seed&0x100 )
 		retval = (Seed&0xff) << 8;
-	else if( Seed&0xffff ) 
+	else if( Seed&0xffff )
 		retval = 0x7fff;
 
 #ifdef _WIN32
@@ -349,7 +355,7 @@ static void __forceinline UpdatePitch( uint coreidx, uint voiceidx )
 		pitch = vc.Pitch;
 	else
 		pitch = (vc.Pitch*(32768 + abs(Cores[coreidx].Voices[voiceidx-1].OutX)))>>15;
-	
+
 	vc.SP+=pitch;
 }
 
@@ -398,7 +404,7 @@ static s32 __forceinline GetVoiceValues_Linear( V_Core& thiscore, uint voiceidx
 	if(Interpolation==0)
 	{
 		return ApplyVolume( vc.PV1, vc.ADSR.Value );
-	} 
+	}
 	else //if(Interpolation==1) //must be linear
 	{
 		s32 t0 = vc.PV2 - vc.PV1;
@@ -471,15 +477,15 @@ static s32 __forceinline __fastcall GetNoiseValues( V_Core& thiscore, uint voice
 /////////////////////////////////////////////////////////////////////////////////////////
 //                                                                                     //
 
-static __forceinline StereoOut32 ReadInputPV( uint core ) 
+static __forceinline StereoOut32 ReadInputPV( uint core )
 {
 	V_Core& thiscore( Cores[core] );
 	u32 pitch = AutoDMAPlayRate[core];
 
 	if(pitch==0) pitch=48000;
-	
+
 	thiscore.ADMAPV += pitch;
-	while(thiscore.ADMAPV>=48000) 
+	while(thiscore.ADMAPV>=48000)
 	{
 		ReadInput( core, thiscore.ADMAP );
 		thiscore.ADMAPV -= 48000;
@@ -520,7 +526,7 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx )
 	// SPU2 Note: The spu2 continues to process voices for eternity, always, so we
 	// have to run through all the motions of updating the voice regardless of it's
 	// audible status.  Otherwise IRQs might not trigger and emulation might fail.
-	
+
 	if( vc.ADSR.Phase > 0 )
 	{
 		UpdatePitch( coreidx, voiceidx );
@@ -556,7 +562,7 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx )
 
 		if (voiceidx==1)      spu2M_WriteFast( 0x400 + (coreidx<<12) + OutPos, 0 );
 		else if (voiceidx==3) spu2M_WriteFast( 0x600 + (coreidx<<12) + OutPos, 0 );
-		
+
 		return StereoOut32( 0, 0 );
 	}
 }
@@ -565,7 +571,7 @@ struct VoiceMixSet
 {
 	static const VoiceMixSet Empty;
 	StereoOut32 Dry, Wet;
-	
+
 	VoiceMixSet() {}
 	VoiceMixSet( const StereoOut32& dry, const StereoOut32& wet ) :
 		Dry( dry ),
@@ -600,15 +606,15 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 
 	// Saturate final result to standard 16 bit range.
 	const VoiceMixSet Voices( clamp_mix( inVoices.Dry ), clamp_mix( inVoices.Wet ) );
-	
+
 	// Write Mixed results To Output Area
 	spu2M_WriteFast( 0x1000 + (coreidx<<12) + OutPos, Voices.Dry.Left );
 	spu2M_WriteFast( 0x1200 + (coreidx<<12) + OutPos, Voices.Dry.Right );
 	spu2M_WriteFast( 0x1400 + (coreidx<<12) + OutPos, Voices.Wet.Left );
 	spu2M_WriteFast( 0x1600 + (coreidx<<12) + OutPos, Voices.Wet.Right );
-	
+
 	// Write mixed results to logfile (if enabled)
-	
+
 	WaveDump::WriteCore( coreidx, CoreSrc_DryVoiceMix, Voices.Dry );
 	WaveDump::WriteCore( coreidx, CoreSrc_WetVoiceMix, Voices.Wet );
 
@@ -618,7 +624,7 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 		Input.Left & thiscore.DryGate.InpL,
 		Input.Right & thiscore.DryGate.InpR
 	);
-	
+
 	// Mix in the Voice data
 	TD.Left += Voices.Dry.Left & thiscore.DryGate.SndL;
 	TD.Right += Voices.Dry.Right & thiscore.DryGate.SndR;
@@ -626,7 +632,7 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 	// Mix in the External (nothing/core0) data
 	TD.Left += Ext.Left & thiscore.DryGate.ExtL;
 	TD.Right += Ext.Right & thiscore.DryGate.ExtR;
-	
+
 	if( !EffectsDisabled )
 	{
 		//Reverb pointer advances regardless of the FxEnable bit...
@@ -639,10 +645,10 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 				Input.Left & thiscore.WetGate.InpL,
 				Input.Right & thiscore.WetGate.InpR
 			);
-			
+
 			TW.Left += Voices.Wet.Left & thiscore.WetGate.SndL;
 			TW.Right += Voices.Wet.Right & thiscore.WetGate.SndR;
-			TW.Left += Ext.Left & thiscore.WetGate.ExtL; 
+			TW.Left += Ext.Left & thiscore.WetGate.ExtL;
 			TW.Right += Ext.Right & thiscore.WetGate.ExtR;
 
 			WaveDump::WriteCore( coreidx, CoreSrc_PreReverb, TW );
@@ -653,7 +659,7 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 			// causes slight overflows in some games, and the volume boost is required.
 			// (like all over volumes on SPU2, reverb coefficients and stuff are signed,
 			// range -50% to 50%, thus *2 is needed)
-			
+
 			RV.Left  *= 2;
 			RV.Right *= 2;
 
@@ -674,7 +680,7 @@ static StereoOut32 __fastcall MixCore( const uint coreidx, const VoiceMixSet& in
 // used to throttle the output rate of cache stat reports
 static int p_cachestat_counter=0;
 
-__forceinline void Mix() 
+__forceinline void Mix()
 {
 	// Note: Playmode 4 is SPDIF, which overrides other inputs.
 	StereoOut32 InputData[2] =
@@ -682,7 +688,7 @@ __forceinline void Mix()
 		(PlayMode&4) ? StereoOut32::Empty : ReadInputPV( 0 ),
 		(PlayMode&8) ? StereoOut32::Empty : ReadInputPV( 1 )
 	};
-	
+
 	WaveDump::WriteCore( 0, CoreSrc_Input, InputData[0] );
 	WaveDump::WriteCore( 1, CoreSrc_Input, InputData[1] );
 
@@ -736,7 +742,7 @@ __forceinline void Mix()
 		spdif_update();
 
 	SndBuffer::Write( Out );
-	
+
 	// Update AutoDMA output positioning
 	OutPos++;
 	if (OutPos>=0x200) OutPos=0;
@@ -752,7 +758,7 @@ __forceinline void Mix()
 				g_counter_cache_misses,
 				g_counter_cache_ignores );
 
-			g_counter_cache_hits = 
+			g_counter_cache_hits =
 			g_counter_cache_misses =
 			g_counter_cache_ignores = 0;
 		}