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:
ramapcsx2 2009-07-15 19:44:06 +00:00
parent 437d05e9f8
commit 258dc05529
10 changed files with 68 additions and 2 deletions

View File

@ -532,6 +532,7 @@ typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
typedef void (CALLBACK* _GSsetBaseMem)(void*);
typedef void (CALLBACK* _GSsetGameCRC)(int, int);
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
typedef void (CALLBACK* _GSsetFrameLimit)(int);
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
typedef void (CALLBACK* _GSreset)();
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
@ -725,6 +726,7 @@ extern _GSprintf GSprintf;
extern _GSsetBaseMem GSsetBaseMem;
extern _GSsetGameCRC GSsetGameCRC;
extern _GSsetFrameSkip GSsetFrameSkip;
extern _GSsetFrameLimit GSsetFrameLimit;
extern _GSsetupRecording GSsetupRecording;
extern _GSreset GSreset;
extern _GSwriteCSR GSwriteCSR;

View File

@ -175,6 +175,7 @@ void gsInit()
// Opens the gsRingbuffer thread.
s32 gsOpen()
{
u32 curFrameLimit = Config.Options & PCSX2_FRAMELIMIT_MASK;
if( m_gsOpened ) return 0;
//video
@ -200,6 +201,23 @@ s32 gsOpen()
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;
}

View File

@ -499,6 +499,23 @@ void CycleFrameLimit(int dir)
newOptions = (Config.Options & ~PCSX2_FRAMELIMIT_MASK) | newFrameLimit;
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) {
case PCSX2_FRAMELIMIT_NORMAL:

View File

@ -46,6 +46,7 @@ _GSprintf GSprintf;
_GSsetBaseMem GSsetBaseMem;
_GSsetGameCRC GSsetGameCRC;
_GSsetFrameSkip GSsetFrameSkip;
_GSsetFrameLimit GSsetFrameLimit;
_GSsetupRecording GSsetupRecording;
_GSreset GSreset;
_GSwriteCSR GSwriteCSR;
@ -341,6 +342,7 @@ int LoadGSplugin(const string& filename)
MapSymbol(GSgetDriverInfo);
MapSymbol(GSsetFrameSkip);
MapSymbol(GSsetFrameLimit);
MapSymbol(GSsetupRecording);
#ifdef _WIN32

View File

@ -291,7 +291,7 @@ EXPORT_C GSsetGameCRC(uint32 crc, int options)
s_gs->SetGameCRC(crc, options);
}
EXPORT_C GSgetLastTag(uint32* tag)
EXPORT_C GSgetLastTag(uint32* tag)
{
s_gs->GetLastTag(tag);
}
@ -301,6 +301,18 @@ EXPORT_C GSsetFrameSkip(int frameskip)
s_gs->SetFrameSkip(frameskip);
}
EXPORT_C GSsetFrameLimit(int limit)
{
if(limit)
{
s_gs->SetFrameLimit(1);
}
else
{
s_gs->SetFrameLimit(0);
}
}
#ifdef _WINDOWS
EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)

View File

@ -251,3 +251,8 @@ bool GSDevice::ResizeTexture(GSTexture** t, int w, int h)
return t2 != NULL;
}
void GSDevice::SetVSync(bool vsync)
{
m_vsync = vsync;
}

View File

@ -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, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true) {}
virtual void SetVSync(bool vsync);
GSTexture* GetCurrent();
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);

View File

@ -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)
{
const GSDrawingContext* context = m_context;

View File

@ -77,6 +77,7 @@ public:
virtual void VSync(int field);
virtual bool MakeSnapshot(const string& path);
virtual void KeyEvent(GSKeyEventData* e);
virtual void SetFrameLimit(bool limit);
virtual bool CanUpscale()
{

View File

@ -30,7 +30,8 @@ EXPORTS
GSreadFIFO2
GSirqCallback
GSsetGameCRC
GSsetFrameSkip
GSsetFrameSkip
GSsetFrameLimit
GSgetLastTag
GSReplay
GSBenchmark