mirror of https://github.com/PCSX2/pcsx2.git
Plugin interface / GSdx changes that binds the GSdx vsync option to the pcsx2 framelimiter.
This patch by matsuri makes playing with vsync a lot nicer, so thanks for that one ;) Note: For now its directx 10 only, due to dx9 needing a swapchain reset.. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1526 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
437d05e9f8
commit
258dc05529
|
@ -532,6 +532,7 @@ typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
|
||||||
typedef void (CALLBACK* _GSsetBaseMem)(void*);
|
typedef void (CALLBACK* _GSsetBaseMem)(void*);
|
||||||
typedef void (CALLBACK* _GSsetGameCRC)(int, int);
|
typedef void (CALLBACK* _GSsetGameCRC)(int, int);
|
||||||
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
|
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
|
||||||
|
typedef void (CALLBACK* _GSsetFrameLimit)(int);
|
||||||
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
|
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
|
||||||
typedef void (CALLBACK* _GSreset)();
|
typedef void (CALLBACK* _GSreset)();
|
||||||
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
|
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
|
||||||
|
@ -725,6 +726,7 @@ extern _GSprintf GSprintf;
|
||||||
extern _GSsetBaseMem GSsetBaseMem;
|
extern _GSsetBaseMem GSsetBaseMem;
|
||||||
extern _GSsetGameCRC GSsetGameCRC;
|
extern _GSsetGameCRC GSsetGameCRC;
|
||||||
extern _GSsetFrameSkip GSsetFrameSkip;
|
extern _GSsetFrameSkip GSsetFrameSkip;
|
||||||
|
extern _GSsetFrameLimit GSsetFrameLimit;
|
||||||
extern _GSsetupRecording GSsetupRecording;
|
extern _GSsetupRecording GSsetupRecording;
|
||||||
extern _GSreset GSreset;
|
extern _GSreset GSreset;
|
||||||
extern _GSwriteCSR GSwriteCSR;
|
extern _GSwriteCSR GSwriteCSR;
|
||||||
|
|
18
pcsx2/GS.cpp
18
pcsx2/GS.cpp
|
@ -175,6 +175,7 @@ void gsInit()
|
||||||
// Opens the gsRingbuffer thread.
|
// Opens the gsRingbuffer thread.
|
||||||
s32 gsOpen()
|
s32 gsOpen()
|
||||||
{
|
{
|
||||||
|
u32 curFrameLimit = Config.Options & PCSX2_FRAMELIMIT_MASK;
|
||||||
if( m_gsOpened ) return 0;
|
if( m_gsOpened ) return 0;
|
||||||
|
|
||||||
//video
|
//video
|
||||||
|
@ -200,6 +201,23 @@ s32 gsOpen()
|
||||||
UpdateVSyncRate()
|
UpdateVSyncRate()
|
||||||
);
|
);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
if(GSsetFrameLimit == NULL)
|
||||||
|
{
|
||||||
|
DevCon::Notice("Notice: GS Plugin does not implement GSsetFrameLimit.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(curFrameLimit == PCSX2_FRAMELIMIT_NORMAL)
|
||||||
|
{
|
||||||
|
GSsetFrameLimit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GSsetFrameLimit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return !m_gsOpened;
|
return !m_gsOpened;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -499,6 +499,23 @@ void CycleFrameLimit(int dir)
|
||||||
newOptions = (Config.Options & ~PCSX2_FRAMELIMIT_MASK) | newFrameLimit;
|
newOptions = (Config.Options & ~PCSX2_FRAMELIMIT_MASK) | newFrameLimit;
|
||||||
|
|
||||||
gsResetFrameSkip();
|
gsResetFrameSkip();
|
||||||
|
|
||||||
|
// Allows sync to vblank only when framelimit is on, if GS can.
|
||||||
|
if(GSsetFrameLimit == NULL)
|
||||||
|
{
|
||||||
|
DevCon::Notice("Notice: GS Plugin does not implement GSsetFrameLimit.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(newFrameLimit)
|
||||||
|
{
|
||||||
|
GSsetFrameLimit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GSsetFrameLimit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(newFrameLimit) {
|
switch(newFrameLimit) {
|
||||||
case PCSX2_FRAMELIMIT_NORMAL:
|
case PCSX2_FRAMELIMIT_NORMAL:
|
||||||
|
|
|
@ -46,6 +46,7 @@ _GSprintf GSprintf;
|
||||||
_GSsetBaseMem GSsetBaseMem;
|
_GSsetBaseMem GSsetBaseMem;
|
||||||
_GSsetGameCRC GSsetGameCRC;
|
_GSsetGameCRC GSsetGameCRC;
|
||||||
_GSsetFrameSkip GSsetFrameSkip;
|
_GSsetFrameSkip GSsetFrameSkip;
|
||||||
|
_GSsetFrameLimit GSsetFrameLimit;
|
||||||
_GSsetupRecording GSsetupRecording;
|
_GSsetupRecording GSsetupRecording;
|
||||||
_GSreset GSreset;
|
_GSreset GSreset;
|
||||||
_GSwriteCSR GSwriteCSR;
|
_GSwriteCSR GSwriteCSR;
|
||||||
|
@ -341,6 +342,7 @@ int LoadGSplugin(const string& filename)
|
||||||
MapSymbol(GSgetDriverInfo);
|
MapSymbol(GSgetDriverInfo);
|
||||||
|
|
||||||
MapSymbol(GSsetFrameSkip);
|
MapSymbol(GSsetFrameSkip);
|
||||||
|
MapSymbol(GSsetFrameLimit);
|
||||||
MapSymbol(GSsetupRecording);
|
MapSymbol(GSsetupRecording);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -291,7 +291,7 @@ EXPORT_C GSsetGameCRC(uint32 crc, int options)
|
||||||
s_gs->SetGameCRC(crc, options);
|
s_gs->SetGameCRC(crc, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_C GSgetLastTag(uint32* tag)
|
EXPORT_C GSgetLastTag(uint32* tag)
|
||||||
{
|
{
|
||||||
s_gs->GetLastTag(tag);
|
s_gs->GetLastTag(tag);
|
||||||
}
|
}
|
||||||
|
@ -301,6 +301,18 @@ EXPORT_C GSsetFrameSkip(int frameskip)
|
||||||
s_gs->SetFrameSkip(frameskip);
|
s_gs->SetFrameSkip(frameskip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT_C GSsetFrameLimit(int limit)
|
||||||
|
{
|
||||||
|
if(limit)
|
||||||
|
{
|
||||||
|
s_gs->SetFrameLimit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_gs->SetFrameLimit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|
||||||
EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
|
EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
|
||||||
|
|
|
@ -251,3 +251,8 @@ bool GSDevice::ResizeTexture(GSTexture** t, int w, int h)
|
||||||
|
|
||||||
return t2 != NULL;
|
return t2 != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSDevice::SetVSync(bool vsync)
|
||||||
|
{
|
||||||
|
m_vsync = vsync;
|
||||||
|
}
|
||||||
|
|
|
@ -103,6 +103,8 @@ public:
|
||||||
virtual void StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
virtual void StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true) {}
|
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true) {}
|
||||||
|
|
||||||
|
virtual void SetVSync(bool vsync);
|
||||||
|
|
||||||
GSTexture* GetCurrent();
|
GSTexture* GetCurrent();
|
||||||
|
|
||||||
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
||||||
|
|
|
@ -435,6 +435,12 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GSRenderer::SetFrameLimit(bool limit)
|
||||||
|
{
|
||||||
|
m_dev->SetVSync(m_vsync && limit);
|
||||||
|
}
|
||||||
|
|
||||||
void GSRenderer::GetTextureMinMax(GSVector4i& r, bool linear)
|
void GSRenderer::GetTextureMinMax(GSVector4i& r, bool linear)
|
||||||
{
|
{
|
||||||
const GSDrawingContext* context = m_context;
|
const GSDrawingContext* context = m_context;
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
virtual void VSync(int field);
|
virtual void VSync(int field);
|
||||||
virtual bool MakeSnapshot(const string& path);
|
virtual bool MakeSnapshot(const string& path);
|
||||||
virtual void KeyEvent(GSKeyEventData* e);
|
virtual void KeyEvent(GSKeyEventData* e);
|
||||||
|
virtual void SetFrameLimit(bool limit);
|
||||||
|
|
||||||
virtual bool CanUpscale()
|
virtual bool CanUpscale()
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,8 @@ EXPORTS
|
||||||
GSreadFIFO2
|
GSreadFIFO2
|
||||||
GSirqCallback
|
GSirqCallback
|
||||||
GSsetGameCRC
|
GSsetGameCRC
|
||||||
GSsetFrameSkip
|
GSsetFrameSkip
|
||||||
|
GSsetFrameLimit
|
||||||
GSgetLastTag
|
GSgetLastTag
|
||||||
GSReplay
|
GSReplay
|
||||||
GSBenchmark
|
GSBenchmark
|
||||||
|
|
Loading…
Reference in New Issue