Merge branch 'master' of github.com:PCSX2/pcsx2

This commit is contained in:
Gregory Hainaut 2015-11-09 22:43:27 +01:00
commit 321193cf44
14 changed files with 29 additions and 431 deletions

View File

@ -1,419 +0,0 @@
#pragma once
#ifndef ASSERT
#ifdef _DEBUG
#include <assert.h>
#define ASSERT assert
#else
#define ASSERT(exp) ((void)0)
#endif
#endif
inline IUnknown* AtlComPtrAssign(IUnknown** pp, IUnknown* lp)
{
if(pp == NULL) return NULL;
if(lp != NULL) lp->AddRef();
if(*pp) (*pp)->Release();
*pp = lp;
return lp;
}
inline IUnknown* AtlComQIPtrAssign(IUnknown** pp, IUnknown* lp, REFIID riid)
{
if(pp == NULL) return NULL;
IUnknown* pTemp = *pp;
if(lp == NULL || FAILED(lp->QueryInterface(riid, (void**)pp))) *pp = NULL;
if(pTemp) pTemp->Release();
return *pp;
}
template<class T> class _NoAddRefReleaseOnCComPtr : public T
{
private:
STDMETHOD_(ULONG, AddRef)() = 0;
STDMETHOD_(ULONG, Release)() = 0;
};
template<class T> class CComPtrBase
{
protected:
CComPtrBase() throw()
{
p = NULL;
}
CComPtrBase(T* lp) throw()
{
p = lp;
if(p != NULL) p->AddRef();
}
void Swap(CComPtrBase& other)
{
T* pTemp = p;
p = other.p;
other.p = pTemp;
}
public:
typedef T _PtrClass;
~CComPtrBase() throw()
{
if(p) p->Release();
}
operator T*() const throw()
{
return p;
}
T& operator*() const
{
ASSERT(p != NULL);
return *p;
}
T** operator&() throw()
{
ASSERT(p == NULL);
return &p;
}
_NoAddRefReleaseOnCComPtr<T>* operator->() const throw()
{
ASSERT(p != NULL);
return (_NoAddRefReleaseOnCComPtr<T>*)p;
}
bool operator!() const throw()
{
return p == NULL;
}
bool operator < (T* pT) const throw()
{
return p < pT;
}
bool operator != (T* pT) const
{
return !operator==(pT);
}
bool operator == (T* pT) const throw()
{
return p == pT;
}
void Release() throw()
{
T* pTemp = p;
if(pTemp)
{
p = NULL;
pTemp->Release();
}
}
bool IsEqualObject(IUnknown* pOther) throw()
{
if(p == NULL && pOther == NULL) return true;
if(p == NULL || pOther == NULL) return false;
CComPtr<IUnknown> punk1;
CComPtr<IUnknown> punk2;
p->QueryInterface(__uuidof(IUnknown), (void**)&punk1);
pOther->QueryInterface(__uuidof(IUnknown), (void**)&punk2);
return punk1 == punk2;
}
void Attach(T* p2) throw()
{
if(p)
{
ULONG ref = p->Release();
(ref);
ASSERT(ref != 0 || p2 != p);
}
p = p2;
}
T* Detach() throw()
{
T* pt = p;
p = NULL;
return pt;
}
HRESULT CopyTo(T** ppT) throw()
{
ASSERT(ppT != NULL);
if(ppT == NULL) return E_POINTER;
*ppT = p;
if(p) p->AddRef();
return S_OK;
}
HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw()
{
ASSERT(p == NULL);
return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&p);
}
template<class Q> HRESULT QueryInterface(Q** pp) const throw()
{
ASSERT(pp != NULL);
return p->QueryInterface(__uuidof(Q), (void**)pp);
}
T* p;
};
template <class T> class CComPtr : public CComPtrBase<T>
{
public:
CComPtr() throw()
{
}
CComPtr(T* lp) throw() : CComPtrBase<T>(lp)
{
}
CComPtr(const CComPtr<T>& lp) throw() : CComPtrBase<T>(lp.p)
{
}
T* operator = (T* lp) throw()
{
if(*this != lp)
{
CComPtr(lp).Swap(*this);
}
return *this;
}
template<typename Q> T* operator = (const CComPtr<Q>& lp) throw()
{
if(!IsEqualObject(lp))
{
return static_cast<T*>(AtlComQIPtrAssign((IUnknown**)&p, lp, __uuidof(T)));
}
return *this;
}
T* operator = (const CComPtr<T>& lp) throw()
{
if(*this != lp)
{
CComPtr(lp).Swap(*this);
}
return *this;
}
CComPtr(CComPtr<T>&& lp) throw() : CComPtrBase<T>()
{
lp.Swap(*this);
}
T* operator = (CComPtr<T>&& lp) throw()
{
if(*this != lp)
{
CComPtr(static_cast<CComPtr&&>(lp)).Swap(*this);
}
return *this;
}
};
template<> class CComPtr<IDispatch> : public CComPtrBase<IDispatch>
{
public:
CComPtr() throw()
{
}
CComPtr(IDispatch* lp) throw() : CComPtrBase<IDispatch>(lp)
{
}
CComPtr(const CComPtr<IDispatch>& lp) throw() : CComPtrBase<IDispatch>(lp.p)
{
}
IDispatch* operator = (IDispatch* lp) throw()
{
if(*this != lp)
{
CComPtr(lp).Swap(*this);
}
return *this;
}
IDispatch* operator = (const CComPtr<IDispatch>& lp) throw()
{
if(*this != lp)
{
CComPtr(lp).Swap(*this);
}
return *this;
}
CComPtr(CComPtr<IDispatch>&& lp) throw() : CComPtrBase<IDispatch>()
{
p = lp.p;
lp.p = NULL;
}
IDispatch* operator = (CComPtr<IDispatch>&& lp) throw()
{
CComPtr(static_cast<CComPtr&&>(lp)).Swap(*this);
return *this;
}
};
template<class T, const IID* piid = &__uuidof(T)> class CComQIPtr : public CComPtr<T>
{
public:
CComQIPtr() throw()
{
}
/*
CComQIPtr(decltype(__nullptr)) throw()
{
}
*/
CComQIPtr(_Inout_opt_ T* lp) throw() : CComPtr<T>(lp)
{
}
CComQIPtr(_Inout_ const CComQIPtr<T,piid>& lp) throw() : CComPtr<T>(lp.p)
{
}
CComQIPtr(_Inout_opt_ IUnknown* lp) throw()
{
if(lp != NULL)
{
if(FAILED(lp->QueryInterface(*piid, (void **)&p)))
{
p = NULL;
}
}
}
/*
T* operator=(decltype(__nullptr)) throw()
{
CComQIPtr(nullptr).Swap(*this);
return nullptr;
}
*/
T* operator = (T* lp) throw()
{
if(*this != lp)
{
CComQIPtr(lp).Swap(*this);
}
return *this;
}
T* operator = (const CComQIPtr<T, piid>& lp) throw()
{
if(*this != lp)
{
CComQIPtr(lp).Swap(*this);
}
return *this;
}
T* operator = (IUnknown* lp) throw()
{
if(*this != lp)
{
return static_cast<T*>(AtlComQIPtrAssign((IUnknown**)&p, lp, *piid));
}
return *this;
}
};
template<> class CComQIPtr<IUnknown, &IID_IUnknown> : public CComPtr<IUnknown>
{
public:
CComQIPtr() throw()
{
}
CComQIPtr(IUnknown* lp) throw()
{
if(lp != NULL)
{
if(FAILED(lp->QueryInterface(__uuidof(IUnknown), (void **)&p)))
{
p = NULL;
}
}
}
CComQIPtr(const CComQIPtr<IUnknown,&IID_IUnknown>& lp) throw() : CComPtr<IUnknown>(lp.p)
{
}
IUnknown* operator = (IUnknown* lp) throw()
{
if(*this != lp)
{
return AtlComQIPtrAssign((IUnknown**)&p, lp, __uuidof(IUnknown));
}
return *this;
}
IUnknown* operator = (const CComQIPtr<IUnknown,&IID_IUnknown>& lp) throw()
{
if(*this != lp)
{
CComQIPtr(lp).Swap(*this);
}
return *this;
}
};

View File

@ -100,6 +100,7 @@ static __fi void vuExecMicro(int idx, u32 addr) {
GetVifX.queued_program = true;
GetVifX.queued_pc = addr;
GetVifX.unpackcalls = 0;
}
void ExecuteVU(int idx)

View File

@ -80,7 +80,7 @@ struct vifStruct {
tVIF_CTRL vifstalled;
bool stallontag;
bool waitforvu;
int unpackcalls;
// GS registers used for calculating the size of the last local->host transfer initiated on the GS
// Transfer size calculation should be restricted to GS emulation in the future
tBITBLTBUF BITBLTBUF;

View File

@ -193,8 +193,12 @@ _vifT void vifUnpackSetup(const u32 *data) {
vifX.cmd = 0;
return; // Skipping write and 0 write-cycles, so do nothing!
}
GetVifX.unpackcalls++;
if (GetVifX.unpackcalls > 3)
{
vifExecQueue(idx);
}
//if (!idx) vif0FLUSH(); // Only VU0?
vifX.usn = (vifXRegs.code >> 14) & 0x01;

View File

@ -236,7 +236,7 @@ Dialogs::SysConfigDialog::SysConfigDialog(wxWindow* parent)
}
Dialogs::ComponentsConfigDialog::ComponentsConfigDialog(wxWindow* parent)
: BaseConfigurationDialog( parent, AddAppName(_("Components Selectors - %s")), 650 )
: BaseConfigurationDialog( parent, AddAppName(_("Components Selectors - %s")), 750 )
{
ScopedBusyCursor busy( Cursor_ReallyBusy );

View File

@ -146,6 +146,8 @@ void Panels::GameFixesPanel::EnableStuff( AppConfig* configToUse )
if( !configToUse ) configToUse = g_Conf;
for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i)
m_checkbox[i]->Enable(m_check_Enable->GetValue() && !configToUse->EnablePresets);
Layout();
}
void Panels::GameFixesPanel::OnEnable_Toggled( wxCommandEvent& evt )

View File

@ -265,6 +265,11 @@ void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse )
m_check_fastCDVD->Enable(HacksEnabledAndNoPreset);
m_check_vuThread->Enable(hacksEnabled); // MTVU is unaffected by presets
// Layout necessary to ensure changed slider text gets re-aligned properly
// and to properly gray/ungray pxStaticText stuff (I suspect it causes a
// paint event to be sent on Windows)
Layout();
}
void Panels::SpeedHacksPanel::AppStatusEvent_OnSettingsApplied()
@ -296,9 +301,6 @@ void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, int fl
// Then, lock(gray out)/unlock the widgets as necessary.
EnableStuff( &configToApply );
// Layout necessary to ensure changed slider text gets re-aligned properly
Layout();
//Console.WriteLn("SpeedHacksPanel::ApplyConfigToGui: EnabledPresets: %s", configToApply.EnablePresets?"true":"false");
}

View File

@ -358,5 +358,7 @@ void Panels::VideoPanel::ApplyConfigToGui( AppConfig& configToApply, int flags )
m_span->ApplyConfigToGui( configToApply, true );
m_fpan->ApplyConfigToGui( configToApply, true );
}
Layout();
}

View File

@ -42,8 +42,7 @@
#include <d3d9.h>
#include <d3dx9.h>
#include <comutil.h>
#include "../../common/include/comptr.h"
#include <atlcomcli.h>
#define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA)
#define D3D11_SHADER_MACRO D3D10_SHADER_MACRO

View File

@ -63,6 +63,7 @@ float VolumeAdjustBR;
float VolumeAdjustSL;
float VolumeAdjustSR;
float VolumeAdjustLFE;
int delayCycles;
bool postprocess_filter_enabled = true;
bool postprocess_filter_dealias = false;
@ -112,6 +113,7 @@ void ReadSettings()
VolumeAdjustSL = powf(10, VolumeAdjustSLdb / 10);
VolumeAdjustSR = powf(10, VolumeAdjustSRdb / 10);
VolumeAdjustLFE = powf(10, VolumeAdjustLFEdb / 10);
delayCycles = CfgReadInt(L"DEBUG", L"DelayCycles", 4);
wxString temp;
@ -180,6 +182,7 @@ void WriteSettings()
CfgWriteStr(L"OUTPUT",L"Output_Module", mods[OutputModule]->GetIdent() );
CfgWriteInt(L"OUTPUT",L"Latency", SndOutLatencyMS);
CfgWriteInt(L"OUTPUT",L"Synch_Mode", SynchMode);
CfgWriteInt(L"DEBUG", L"DelayCycles", delayCycles);
PortaudioOut->WriteSettings();
SDLOut->WriteSettings();

View File

@ -45,6 +45,7 @@ extern float VolumeAdjustBR;
extern float VolumeAdjustSL;
extern float VolumeAdjustSR;
extern float VolumeAdjustLFE;
extern int delayCycles;
struct Stereo51Out16DplII;
struct Stereo51Out32DplII;

View File

@ -58,6 +58,7 @@ float VolumeAdjustBR;
float VolumeAdjustSL;
float VolumeAdjustSR;
float VolumeAdjustLFE;
int delayCycles;
bool postprocess_filter_enabled = 1;
bool postprocess_filter_dealias = false;
@ -114,6 +115,7 @@ void ReadSettings()
VolumeAdjustSLdb = CfgReadFloat(L"MIXING", L"VolumeAdjustSL(dB)", 0);
VolumeAdjustSRdb = CfgReadFloat(L"MIXING", L"VolumeAdjustSR(dB)", 0);
VolumeAdjustLFEdb = CfgReadFloat(L"MIXING", L"VolumeAdjustLFE(dB)", 0);
delayCycles = CfgReadInt(L"DEBUG", L"DelayCycles", 4);
VolumeAdjustC = powf(10, VolumeAdjustCdb / 10);
VolumeAdjustFL = powf(10, VolumeAdjustFLdb / 10);
VolumeAdjustFR = powf(10, VolumeAdjustFRdb / 10);
@ -198,6 +200,7 @@ void WriteSettings()
CfgWriteInt(L"OUTPUT",L"Synch_Mode", SynchMode);
CfgWriteInt(L"OUTPUT",L"SpeakerConfiguration", numSpeakers);
CfgWriteInt( L"OUTPUT", L"DplDecodingLevel", dplLevel);
CfgWriteInt(L"DEBUG", L"DelayCycles", delayCycles);
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = L"default";
CfgWriteStr(L"WAVEOUT",L"Device",Config_WaveOut.Device);

View File

@ -21,7 +21,7 @@
#include "Dialogs.h"
#include <xaudio2.h>
#include "../../common/include/comptr.h"
#include <atlcomcli.h>
namespace Exception
{

View File

@ -306,10 +306,10 @@ void V_Core::UpdateEffectsBufferSize()
void V_Voice::QueueStart()
{
if (Cycles - PlayCycle < 4)
if (Cycles - PlayCycle < delayCycles)
{
// Required by The Legend of Spyro: The Eternal Night (probably the other two legend games too)
ConLog(" *** KeyOn after less than 4 T disregarded.\n");
ConLog(" *** KeyOn after less than %d T disregarded.\n", delayCycles);
return;
}
PlayCycle = Cycles;
@ -317,7 +317,7 @@ void V_Voice::QueueStart()
bool V_Voice::Start()
{
if((Cycles-PlayCycle)>=4)
if((Cycles-PlayCycle)>= delayCycles)
{
if(StartA&7)
{