Plugin API for GS: Changed the new GSgetTitleInfo callback to use a more sensible parameter passing system.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4072 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-12-03 03:45:34 +00:00
parent aaaa71e13b
commit 49527d952c
4 changed files with 7 additions and 10 deletions

View File

@ -278,7 +278,7 @@ void CALLBACK GSsetFrameSkip(int frameskip);
int CALLBACK GSsetupRecording(int start, void* pData); int CALLBACK GSsetupRecording(int start, void* pData);
void CALLBACK GSreset(); void CALLBACK GSreset();
void CALLBACK GSgetTitleInfo( char dest[128] ); void CALLBACK GSgetTitleInfo( char* dest, size_t length );
void CALLBACK GSwriteCSR(u32 value); void CALLBACK GSwriteCSR(u32 value);
s32 CALLBACK GSfreeze(int mode, freezeData *data); s32 CALLBACK GSfreeze(int mode, freezeData *data);
void CALLBACK GSconfigure(); void CALLBACK GSconfigure();
@ -575,7 +575,7 @@ typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
typedef void (CALLBACK* _GSgetTitleInfo)(char dest[128]); typedef void (CALLBACK* _GSgetTitleInfo)(char* dest, size_t length);
typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
typedef void (CALLBACK* _GSsetBaseMem)(void*); typedef void (CALLBACK* _GSsetBaseMem)(void*);

View File

@ -185,7 +185,7 @@ static void CALLBACK GS_printf(int timeout, char *fmt, ...)
Console.WriteLn(msg); Console.WriteLn(msg);
} }
void CALLBACK GS_getTitleInfo( char dest[128] ) void CALLBACK GS_getTitleInfo( char* dest, size_t length )
{ {
// Just return a generic "GS" title -- a plugin actually implementing this feature // Just return a generic "GS" title -- a plugin actually implementing this feature
// should return a title such as "GSdx" or "ZZogl" instead. --air // should return a title such as "GSdx" or "ZZogl" instead. --air

View File

@ -386,7 +386,7 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
double fps = wxGetApp().FpsManager.GetFramerate(); double fps = wxGetApp().FpsManager.GetFramerate();
char gsDest[128]; char gsDest[128];
GSgetTitleInfo( gsDest ); GSgetTitleInfo( gsDest, sizeof(gsDest) );
const wxChar* limiterStr = L"None"; const wxChar* limiterStr = L"None";

View File

@ -478,18 +478,15 @@ EXPORT_C GSgetLastTag(uint32* tag)
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
EXPORT_C GSgetTitleInfo(char dest[128]) EXPORT_C GSgetTitleInfo(char* dest, size_t length)
{ {
// NOTE: MSVC appears to generate an incorrect sizeof for dest, returning 4 (size of a pointer)
// instead of 128. So let's hardcode it. (sigh). --air
if (!s_gs->m_GStitleInfoBuffer[0]) if (!s_gs->m_GStitleInfoBuffer[0])
strcpy(dest, "GSdx"); strcpy(dest, "GSdx");
else else
{ {
EnterCriticalSection(&s_gs->m_pGSsetTitle_Crit); EnterCriticalSection(&s_gs->m_pGSsetTitle_Crit);
snprintf(dest, 127, "GSdx | %s", s_gs->m_GStitleInfoBuffer); snprintf(dest, length-1, "GSdx | %s", s_gs->m_GStitleInfoBuffer);
dest[127] = 0; // just in case! dest[length-1] = 0; // just in case!
LeaveCriticalSection(&s_gs->m_pGSsetTitle_Crit); LeaveCriticalSection(&s_gs->m_pGSsetTitle_Crit);
} }
} }