From 393963f5780627cd870ea4b4071f996f06376a76 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 2 May 2010 03:09:20 +0000 Subject: [PATCH] zzogl-pg: Separate out some profile code. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2934 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/zzogl-pg/opengl/GSmain.cpp | 242 +--------------- plugins/zzogl-pg/opengl/Makefile.am | 2 +- plugins/zzogl-pg/opengl/Profile.cpp | 259 ++++++++++++++++++ plugins/zzogl-pg/opengl/Profile.h | 146 ++++++++++ plugins/zzogl-pg/opengl/Util.h | 139 +--------- plugins/zzogl-pg/opengl/Win32/Conf.cpp | 8 + .../zzogl-pg/opengl/Win32/zerogsogl.vcxproj | 2 + .../opengl/Win32/zerogsogl_2008.vcproj | 8 + 8 files changed, 439 insertions(+), 367 deletions(-) create mode 100644 plugins/zzogl-pg/opengl/Profile.cpp create mode 100644 plugins/zzogl-pg/opengl/Profile.h diff --git a/plugins/zzogl-pg/opengl/GSmain.cpp b/plugins/zzogl-pg/opengl/GSmain.cpp index fbb5d1e106..3ec7b8521b 100644 --- a/plugins/zzogl-pg/opengl/GSmain.cpp +++ b/plugins/zzogl-pg/opengl/GSmain.cpp @@ -37,6 +37,7 @@ using namespace std; #include "GS.h" #include "Mem.h" #include "Regs.h" +#include "Profile.h" #include "zerogs.h" #include "targets.h" @@ -92,12 +93,6 @@ extern int g_nPixelShaderVer; extern int g_nFrameRender; extern int g_nFramesSkipped; -#if !defined(ZEROGS_DEVBUILD) -#define g_bWriteProfile 0 -#else -bool g_bWriteProfile = 0; -#endif - int s_frameskipping = 0; u32 CALLBACK PS2EgetLibType() { @@ -114,8 +109,6 @@ u32 CALLBACK PS2EgetLibVersion2(u32 type) return (zgsversion << 16) | (zgsrevision << 8) | zgsbuild | (zgsminor << 24); } -static u64 luPerfFreq; - GLWindow GLWin; #ifdef _WIN32 @@ -1135,236 +1128,3 @@ s32 CALLBACK GSfreeze(int mode, freezeData *data) return 0; } - -//////////////////// -// Small profiler // -//////////////////// -#include -#include -#include - -using namespace std; - -#define GET_PROFILE_TIME() GetCPUTicks() - -struct DVPROFSTRUCT; - -struct DVPROFSTRUCT -{ - - struct DATA - { - DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {} - - DATA() : dwTime(0), dwUserData(0) {} - - u64 dwTime; - u32 dwUserData; - }; - - ~DVPROFSTRUCT() - { - list::iterator it = listpChild.begin(); - - while (it != listpChild.end()) - { - SAFE_DELETE(*it); - ++it; - } - } - - list listTimes; // before DVProfEnd is called, contains the global time it started - // after DVProfEnd is called, contains the time it lasted - // the list contains all the tracked times - char pname[256]; - - list listpChild; // other profilers called during this profiler period -}; - -struct DVPROFTRACK -{ - u32 dwUserData; - DVPROFSTRUCT::DATA* pdwTime; - DVPROFSTRUCT* pprof; -}; - -list g_listCurTracking; // the current profiling functions, the back element is the -// one that will first get popped off the list when DVProfEnd is called -// the pointer is an element in DVPROFSTRUCT::listTimes -list g_listProfilers; // the current profilers, note that these are the parents -// any profiler started during the time of another is held in -// DVPROFSTRUCT::listpChild -list g_listAllProfilers; // ignores the hierarchy, pointer to elements in g_listProfilers - -void DVProfRegister(char* pname) -{ - if (!g_bWriteProfile) - return; - - list::iterator it = g_listAllProfilers.begin(); - -// while(it != g_listAllProfilers.end() ) { -// -// if( _tcscmp(pname, (*it)->pname) == 0 ) { -// (*it)->listTimes.push_back(timeGetTime()); -// DVPROFTRACK dvtrack; -// dvtrack.pdwTime = &(*it)->listTimes.back(); -// dvtrack.pprof = *it; -// g_listCurTracking.push_back(dvtrack); -// return; -// } -// -// ++it; -// } - - // else add in a new profiler to the appropriate parent profiler - DVPROFSTRUCT* pprof = NULL; - - if (g_listCurTracking.size() > 0) - { - assert(g_listCurTracking.back().pprof != NULL); - g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT()); - pprof = g_listCurTracking.back().pprof->listpChild.back(); - } - else - { - g_listProfilers.push_back(DVPROFSTRUCT()); - pprof = &g_listProfilers.back(); - } - - strncpy(pprof->pname, pname, 256); - - // setup the profiler for tracking - pprof->listTimes.push_back(DVPROFSTRUCT::DATA(GET_PROFILE_TIME())); - - DVPROFTRACK dvtrack; - dvtrack.pdwTime = &pprof->listTimes.back(); - dvtrack.pprof = pprof; - dvtrack.dwUserData = 0; - - g_listCurTracking.push_back(dvtrack); - - // add to all profiler list - g_listAllProfilers.push_back(pprof); -} - -void DVProfEnd(u32 dwUserData) -{ - if (!g_bWriteProfile) - return; - - B_RETURN(g_listCurTracking.size() > 0); - - DVPROFTRACK dvtrack = g_listCurTracking.back(); - - assert(dvtrack.pdwTime != NULL && dvtrack.pprof != NULL); - - dvtrack.pdwTime->dwTime = 1000000 * (GET_PROFILE_TIME() - dvtrack.pdwTime->dwTime) / luPerfFreq; - - dvtrack.pdwTime->dwUserData = dwUserData; - - g_listCurTracking.pop_back(); -} - -struct DVTIMEINFO -{ - DVTIMEINFO() : uInclusive(0), uExclusive(0) {} - - u64 uInclusive, uExclusive; -}; - -map mapAggregateTimes; - -u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident) -{ - fprintf(f, "%*s%s - ", ident, "", p->pname); - - list::iterator ittime = p->listTimes.begin(); - - u32 utime = 0; - - while (ittime != p->listTimes.end()) - { - utime += (u32)ittime->dwTime; - - if (ittime->dwUserData) - fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData); - else - fprintf(f, "time: %d", (u32)ittime->dwTime); - - ++ittime; - } - - mapAggregateTimes[p->pname].uInclusive += utime; - - fprintf(f, "\n"); - - list::iterator itprof = p->listpChild.begin(); - - u32 uex = utime; - - while (itprof != p->listpChild.end()) - { - - uex -= DVProfWriteStruct(f, *itprof, ident + 4); - ++itprof; - } - - mapAggregateTimes[p->pname].uExclusive += uex; - - return utime; -} - -void DVProfWrite(char* pfilename, u32 frames) -{ - assert(pfilename != NULL); - FILE* f = fopen(pfilename, "wb"); - - mapAggregateTimes.clear(); - list::iterator it = g_listProfilers.begin(); - - while (it != g_listProfilers.end()) - { - DVProfWriteStruct(f, &(*it), 0); - ++it; - } - - { - map::iterator it; - fprintf(f, "\n\n-------------------------------------------------------------------\n\n"); - - u64 uTotal[2] = {0}; - double fiTotalTime[2]; - - for (it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) - { - uTotal[0] += it->second.uExclusive; - uTotal[1] += it->second.uInclusive; - } - - fprintf(f, "total times (%d): ex: %Lu ", frames, uTotal[0] / frames); - - fprintf(f, "inc: %Lu\n", uTotal[1] / frames); - - fiTotalTime[0] = 1.0 / (double)uTotal[0]; - fiTotalTime[1] = 1.0 / (double)uTotal[1]; - - // output the combined times - - for (it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) - { - fprintf(f, "%s - ex: %f inc: %f\n", it->first.c_str(), (double)it->second.uExclusive * fiTotalTime[0], - (double)it->second.uInclusive * fiTotalTime[1]); - } - } - - - fclose(f); -} - -void DVProfClear() -{ - g_listCurTracking.clear(); - g_listProfilers.clear(); - g_listAllProfilers.clear(); -} diff --git a/plugins/zzogl-pg/opengl/Makefile.am b/plugins/zzogl-pg/opengl/Makefile.am index 744a9a11bd..faf2a7fc32 100644 --- a/plugins/zzogl-pg/opengl/Makefile.am +++ b/plugins/zzogl-pg/opengl/Makefile.am @@ -24,7 +24,7 @@ libzzoglpg_LDFLAGS+=-Wl,-soname,@ZEROGS_SONAME@ libzzoglpg_LDADD=$(libzzoglpg_a_OBJECTS) libzzoglpg_a_SOURCES = \ -GSmain.cpp GLWinX11.cpp GifTransfer.cpp memcpy_amd.cpp Regs.cpp x86.cpp zpipe.cpp Mem.cpp \ +GSmain.cpp GLWinX11.cpp GifTransfer.cpp memcpy_amd.cpp Regs.cpp x86.cpp zpipe.cpp Mem.cpp Profile.cpp Profile.h \ rasterfont.cpp targets.cpp zerogs.cpp ZZoglVB.cpp ZZoglShoots.cpp ZZoglCreate.cpp \ ZZoglShaders.cpp ZZoglCRTC.cpp ZZoglSave.cpp ZZoglFlush.cpp \ Mem_Swizzle.h Mem_Tables.cpp Mem_Transmit.h Mem_Swizzle.cpp diff --git a/plugins/zzogl-pg/opengl/Profile.cpp b/plugins/zzogl-pg/opengl/Profile.cpp new file mode 100644 index 0000000000..170b45469c --- /dev/null +++ b/plugins/zzogl-pg/opengl/Profile.cpp @@ -0,0 +1,259 @@ +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 zerofrog@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +//////////////////// +// Small profiler // +//////////////////// +#include +#include +#include +#include "Profile.h" + +using namespace std; + +#define GET_PROFILE_TIME() GetCPUTicks() + +#if !defined(ZEROGS_DEVBUILD) +#define g_bWriteProfile 0 +#else +bool g_bWriteProfile = 0; +#endif + +u64 luPerfFreq; + +struct DVPROFSTRUCT; + +struct DVPROFSTRUCT +{ + + struct DATA + { + DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {} + + DATA() : dwTime(0), dwUserData(0) {} + + u64 dwTime; + u32 dwUserData; + }; + + ~DVPROFSTRUCT() + { + list::iterator it = listpChild.begin(); + + while (it != listpChild.end()) + { + SAFE_DELETE(*it); + ++it; + } + } + + list listTimes; // before DVProfEnd is called, contains the global time it started + // after DVProfEnd is called, contains the time it lasted + // the list contains all the tracked times + char pname[256]; + + list listpChild; // other profilers called during this profiler period +}; + +struct DVPROFTRACK +{ + u32 dwUserData; + DVPROFSTRUCT::DATA* pdwTime; + DVPROFSTRUCT* pprof; +}; + +list g_listCurTracking; // the current profiling functions, the back element is the +// one that will first get popped off the list when DVProfEnd is called +// the pointer is an element in DVPROFSTRUCT::listTimes +list g_listProfilers; // the current profilers, note that these are the parents +// any profiler started during the time of another is held in +// DVPROFSTRUCT::listpChild +list g_listAllProfilers; // ignores the hierarchy, pointer to elements in g_listProfilers + +void DVProfRegister(char* pname) +{ + if (!g_bWriteProfile) return; + + list::iterator it = g_listAllProfilers.begin(); + +// while(it != g_listAllProfilers.end() ) { +// +// if( _tcscmp(pname, (*it)->pname) == 0 ) { +// (*it)->listTimes.push_back(timeGetTime()); +// DVPROFTRACK dvtrack; +// dvtrack.pdwTime = &(*it)->listTimes.back(); +// dvtrack.pprof = *it; +// g_listCurTracking.push_back(dvtrack); +// return; +// } +// +// ++it; +// } + + // else add in a new profiler to the appropriate parent profiler + DVPROFSTRUCT* pprof = NULL; + + if (g_listCurTracking.size() > 0) + { + assert(g_listCurTracking.back().pprof != NULL); + g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT()); + pprof = g_listCurTracking.back().pprof->listpChild.back(); + } + else + { + g_listProfilers.push_back(DVPROFSTRUCT()); + pprof = &g_listProfilers.back(); + } + + strncpy(pprof->pname, pname, 256); + + // setup the profiler for tracking + pprof->listTimes.push_back(DVPROFSTRUCT::DATA(GET_PROFILE_TIME())); + + DVPROFTRACK dvtrack; + dvtrack.pdwTime = &pprof->listTimes.back(); + dvtrack.pprof = pprof; + dvtrack.dwUserData = 0; + + g_listCurTracking.push_back(dvtrack); + + // add to all profiler list + g_listAllProfilers.push_back(pprof); +} + +void DVProfEnd(u32 dwUserData) +{ + if (!g_bWriteProfile) + return; + + B_RETURN(g_listCurTracking.size() > 0); + + DVPROFTRACK dvtrack = g_listCurTracking.back(); + + assert(dvtrack.pdwTime != NULL && dvtrack.pprof != NULL); + + dvtrack.pdwTime->dwTime = 1000000 * (GET_PROFILE_TIME() - dvtrack.pdwTime->dwTime) / luPerfFreq; + + dvtrack.pdwTime->dwUserData = dwUserData; + + g_listCurTracking.pop_back(); +} + +struct DVTIMEINFO +{ + DVTIMEINFO() : uInclusive(0), uExclusive(0) {} + + u64 uInclusive, uExclusive; +}; + +map mapAggregateTimes; + +u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident) +{ + fprintf(f, "%*s%s - ", ident, "", p->pname); + + list::iterator ittime = p->listTimes.begin(); + + u32 utime = 0; + + while (ittime != p->listTimes.end()) + { + utime += (u32)ittime->dwTime; + + if (ittime->dwUserData) + fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData); + else + fprintf(f, "time: %d", (u32)ittime->dwTime); + + ++ittime; + } + + mapAggregateTimes[p->pname].uInclusive += utime; + + fprintf(f, "\n"); + + list::iterator itprof = p->listpChild.begin(); + + u32 uex = utime; + + while (itprof != p->listpChild.end()) + { + + uex -= DVProfWriteStruct(f, *itprof, ident + 4); + ++itprof; + } + + mapAggregateTimes[p->pname].uExclusive += uex; + + return utime; +} + +void DVProfWrite(char* pfilename, u32 frames) +{ + assert(pfilename != NULL); + FILE* f = fopen(pfilename, "wb"); + + mapAggregateTimes.clear(); + list::iterator it = g_listProfilers.begin(); + + while (it != g_listProfilers.end()) + { + DVProfWriteStruct(f, &(*it), 0); + ++it; + } + + { + map::iterator it; + fprintf(f, "\n\n-------------------------------------------------------------------\n\n"); + + u64 uTotal[2] = {0}; + double fiTotalTime[2]; + + for (it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) + { + uTotal[0] += it->second.uExclusive; + uTotal[1] += it->second.uInclusive; + } + + fprintf(f, "total times (%d): ex: %Lu ", frames, uTotal[0] / frames); + + fprintf(f, "inc: %Lu\n", uTotal[1] / frames); + + fiTotalTime[0] = 1.0 / (double)uTotal[0]; + fiTotalTime[1] = 1.0 / (double)uTotal[1]; + + // output the combined times + + for (it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) + { + fprintf(f, "%s - ex: %f inc: %f\n", it->first.c_str(), (double)it->second.uExclusive * fiTotalTime[0], + (double)it->second.uInclusive * fiTotalTime[1]); + } + } + + + fclose(f); +} + +void DVProfClear() +{ + g_listCurTracking.clear(); + g_listProfilers.clear(); + g_listAllProfilers.clear(); +} diff --git a/plugins/zzogl-pg/opengl/Profile.h b/plugins/zzogl-pg/opengl/Profile.h new file mode 100644 index 0000000000..df81155278 --- /dev/null +++ b/plugins/zzogl-pg/opengl/Profile.h @@ -0,0 +1,146 @@ +/* ZeroGS KOSMOS + * Copyright (C) 2005-2006 zerofrog@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef PROFILE_H_INCLUDED +#define PROFILE_H_INCLUDED + +#include "zerogs.h" + +#if !defined(ZEROGS_DEVBUILD) +#define g_bWriteProfile 0 +#else +extern bool g_bWriteProfile; +#endif + +extern u64 luPerfFreq; + + +// Copied from Utilities; remove later. +#ifdef __LINUX__ + +#include + +static __forceinline void InitCPUTicks() +{ +} + +static __forceinline u64 GetTickFrequency() +{ + return 1000000; // unix measures in microseconds +} + +static __forceinline u64 GetCPUTicks() +{ + + struct timeval t; + gettimeofday(&t, NULL); + return ((u64)t.tv_sec*GetTickFrequency()) + t.tv_usec; +} + +#else +static __aligned16 LARGE_INTEGER lfreq; + +static __forceinline void InitCPUTicks() +{ + QueryPerformanceFrequency(&lfreq); +} + +static __forceinline u64 GetTickFrequency() +{ + return lfreq.QuadPart; +} + +static __forceinline u64 GetCPUTicks() +{ + LARGE_INTEGER count; + QueryPerformanceCounter(&count); + return count.QuadPart; +} + +#endif + +// IMPORTANT: For every Register there must be an End +void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers +void DVProfEnd(u32 dwUserData); +void DVProfWrite(char* pfilename, u32 frames = 0); +void DVProfClear(); // clears all the profilers + +#define DVPROFILE +#ifdef DVPROFILE + +class DVProfileFunc +{ + public: + u32 dwUserData; + DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; } + DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } + ~DVProfileFunc() { DVProfEnd(dwUserData); } +}; + +#else + +class DVProfileFunc +{ + + public: + u32 dwUserData; + static __forceinline DVProfileFunc(char* pname) {} + static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { } + ~DVProfileFunc() {} +}; + +#endif + + +template +class CInterfacePtr +{ + + public: + inline CInterfacePtr() : ptr(NULL) {} + inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if (ptr != NULL) ptr->AddRef(); } + inline ~CInterfacePtr() { if (ptr != NULL) ptr->Release(); } + inline T* operator*() { assert(ptr != NULL); return *ptr; } + inline T* operator->() { return ptr; } + inline T* get() { return ptr; } + + inline void release() + { + if (ptr != NULL) { ptr->Release(); ptr = NULL; } + } + + inline operator T*() { return ptr; } + inline bool operator==(T* rhs) { return ptr == rhs; } + inline bool operator!=(T* rhs) { return ptr != rhs; } + + inline CInterfacePtr& operator= (T* newptr) + { + if (ptr != NULL) ptr->Release(); + + ptr = newptr; + + if (ptr != NULL) ptr->AddRef(); + + return *this; + } + + private: + T* ptr; +}; + +#endif // PROFILE_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index f824a4971f..100a0c12f5 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -135,19 +135,22 @@ typedef struct int x, y, c; } PointC; -#define GSOPTION_FULLSCREEN 0x2 -#define GSOPTION_TGASNAP 0x4 -#define GSOPTION_CAPTUREAVI 0x8 +enum GSOption +{ + GSOPTION_FULLSCREEN = 0x2, + GSOPTION_TGASNAP = 0x4, + GSOPTION_CAPTUREAVI = 0x8, -#define GSOPTION_WINDIMS 0x30 -#define GSOPTION_WIN640 0x00 -#define GSOPTION_WIN800 0x10 -#define GSOPTION_WIN1024 0x20 -#define GSOPTION_WIN1280 0x30 -#define GSOPTION_WIDESCREEN 0x40 + GSOPTION_WINDIMS = 0x30, + GSOPTION_WIN640 = 0x00, + GSOPTION_WIN800 = 0x10, + GSOPTION_WIN1024 = 0x20, + GSOPTION_WIN1280 = 0x30, + GSOPTION_WIDESCREEN = 0x40, -#define GSOPTION_WIREFRAME 0x100 -#define GSOPTION_LOADED 0x8000 + GSOPTION_WIREFRAME = 0x100, + GSOPTION_LOADED = 0x8000 +}; //Configuration values. @@ -300,118 +303,4 @@ extern "C" void * memcpy_amd(void *dest, const void *src, size_t n); extern "C" u8 memcmp_mmx(const void *dest, const void *src, int n); #endif -// Copied from Utilities; remove later. -#ifdef __LINUX__ - -#include - -static __forceinline void InitCPUTicks() -{ -} - -static __forceinline u64 GetTickFrequency() -{ - return 1000000; // unix measures in microseconds -} - -static __forceinline u64 GetCPUTicks() -{ - - struct timeval t; - gettimeofday(&t, NULL); - return ((u64)t.tv_sec*GetTickFrequency()) + t.tv_usec; -} - -#else -static __aligned16 LARGE_INTEGER lfreq; - -static __forceinline void InitCPUTicks() -{ - QueryPerformanceFrequency(&lfreq); -} - -static __forceinline u64 GetTickFrequency() -{ - return lfreq.QuadPart; -} - -static __forceinline u64 GetCPUTicks() -{ - LARGE_INTEGER count; - QueryPerformanceCounter(&count); - return count.QuadPart; -} - -#endif - -template - -class CInterfacePtr -{ - - public: - inline CInterfacePtr() : ptr(NULL) {} - inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if (ptr != NULL) ptr->AddRef(); } - inline ~CInterfacePtr() { if (ptr != NULL) ptr->Release(); } - inline T* operator*() { assert(ptr != NULL); return *ptr; } - inline T* operator->() { return ptr; } - inline T* get() { return ptr; } - - inline void release() - { - if (ptr != NULL) { ptr->Release(); ptr = NULL; } - } - - inline operator T*() { return ptr; } - inline bool operator==(T* rhs) { return ptr == rhs; } - inline bool operator!=(T* rhs) { return ptr != rhs; } - - inline CInterfacePtr& operator= (T* newptr) - { - if (ptr != NULL) ptr->Release(); - - ptr = newptr; - - if (ptr != NULL) ptr->AddRef(); - - return *this; - } - - private: - T* ptr; -}; - - -// IMPORTANT: For every Register there must be an End -void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers -void DVProfEnd(u32 dwUserData); -void DVProfWrite(char* pfilename, u32 frames = 0); -void DVProfClear(); // clears all the profilers - -#define DVPROFILE -#ifdef DVPROFILE - -class DVProfileFunc -{ - public: - u32 dwUserData; - DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; } - DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); } - ~DVProfileFunc() { DVProfEnd(dwUserData); } -}; - -#else - -class DVProfileFunc -{ - - public: - u32 dwUserData; - static __forceinline DVProfileFunc(char* pname) {} - static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { } - ~DVProfileFunc() {} -}; - -#endif - #endif // UTIL_H_INCLUDED diff --git a/plugins/zzogl-pg/opengl/Win32/Conf.cpp b/plugins/zzogl-pg/opengl/Win32/Conf.cpp index 452030d6db..f2cbfeba90 100644 --- a/plugins/zzogl-pg/opengl/Win32/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Conf.cpp @@ -21,6 +21,10 @@ void SaveConfig() WritePrivateProfileString("Settings", "Options", szValue, iniFile.c_str()); sprintf(szValue, "%u", conf.gamesettings); WritePrivateProfileString("Settings", "AdvancedOptions", szValue, iniFile.c_str()); + sprintf(szValue, "%u", conf.width); + WritePrivateProfileString("Settings", "Width", szValue, iniFile.c_str()); + sprintf(szValue, "%u", conf.height); + WritePrivateProfileString("Settings", "Height", szValue, iniFile.c_str()); } void LoadConfig() @@ -57,6 +61,10 @@ void LoadConfig() conf.gamesettings = strtoul(szValue, NULL, 10); GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str()); conf.bilinear = strtoul(szValue, NULL, 10); + GetPrivateProfileString("Settings", "Width", NULL, szValue, 20, iniFile.c_str()); + conf.width = strtoul(szValue, NULL, 10); + GetPrivateProfileString("Settings", "Height", NULL, szValue, 20, iniFile.c_str()); + conf.height = strtoul(szValue, NULL, 10); if (conf.aa < 0 || conf.aa > 4) conf.aa = 0; diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl.vcxproj b/plugins/zzogl-pg/opengl/Win32/zerogsogl.vcxproj index 0b40a9c08d..b293d8db73 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl.vcxproj +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl.vcxproj @@ -148,6 +148,7 @@ + @@ -191,6 +192,7 @@ + diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj index a0867d17f8..fd66f61968 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj @@ -297,6 +297,10 @@ RelativePath="..\Regs.cpp" > + + @@ -425,6 +429,10 @@ RelativePath="..\Regs.h" > + +