Revert changes in GS.h

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@273 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
arcum42 2008-11-02 13:07:04 +00:00 committed by Gregory Hainaut
parent b5a6e33845
commit 787316e839
1 changed files with 83 additions and 75 deletions

View File

@ -73,23 +73,34 @@ extern u8* g_pGSWritePos;
extern FILE* g_fMTGSWrite, *g_fMTGSRead; extern FILE* g_fMTGSWrite, *g_fMTGSRead;
extern u32 g_MTGSDebug, g_MTGSId; extern u32 g_MTGSDebug, g_MTGSId;
static __forceinline void MTGS_RECWRITE(u32 *start, u32 size) { #define MTGS_RECWRITE(start, size) { \
if( g_MTGSDebug & 1 ) { if( g_MTGSDebug & 1 ) { \
u32* pstart = (u32*)(start); u32* pstart = (u32*)(start); \
u32 cursize = (u32)(size); u32 cursize = (u32)(size); \
fprintf(g_fMTGSWrite, "*%x-%x (%d)\n", (u32)(uptr)(start), (u32)(size), ++g_MTGSId); fprintf(g_fMTGSWrite, "*%x-%x (%d)\n", (u32)(uptr)(start), (u32)(size), ++g_MTGSId); \
if( g_MTGSDebug & 2 ) fflush(g_fMTGSWrite); /*while(cursize > 0) { \
} fprintf(g_fMTGSWrite, "%x %x %x %x\n", pstart[0], pstart[1], pstart[2], pstart[3]); \
} pstart += 4; \
cursize -= 16; \
}*/ \
if( g_MTGSDebug & 2 ) fflush(g_fMTGSWrite); \
} \
} \
#define MTGS_RECREAD(start, size) { \
if( g_MTGSDebug & 1 ) { \
u32* pstart = (u32*)(start); \
u32 cursize = (u32)(size); \
fprintf(g_fMTGSRead, "*%x-%x (%d)\n", (u32)(uptr)(start), (u32)(size), ++g_MTGSId); \
/*while(cursize > 0) { \
fprintf(g_fMTGSRead, "%x %x %x %x\n", pstart[0], pstart[1], pstart[2], pstart[3]); \
pstart += 4; \
cursize -= 16; \
}*/ \
if( g_MTGSDebug & 4 ) fflush(g_fMTGSRead); \
} \
} \
static __forceinline void MTGS_RECREAD(start, size) {
if( g_MTGSDebug & 1 ) {
u32* pstart = (u32*)(start);
u32 cursize = (u32)(size);
fprintf(g_fMTGSRead, "*%x-%x (%d)\n", (u32)(uptr)(start), (u32)(size), ++g_MTGSId);
if( g_MTGSDebug & 4 ) fflush(g_fMTGSRead);
}
}
#else #else
#define MTGS_RECWRITE 0&& #define MTGS_RECWRITE 0&&
@ -98,25 +109,21 @@ static __forceinline void MTGS_RECREAD(start, size) {
#endif #endif
// mem and size are the ones from GSRingBufCopy // mem and size are the ones from GSRingBufCopy
static __forceinline void GSRINGBUF_DONECOPY(u8 *mem, u32 size) { #define GSRINGBUF_DONECOPY(mem, size) { \
u8* temp = (u8*)(mem) + (size); u8* temp = (u8*)(mem) + (size); \
assert( temp <= GS_RINGBUFFEREND); assert( temp <= GS_RINGBUFFEREND); \
MTGS_RECWRITE(mem, size); MTGS_RECWRITE(mem, size); \
if( temp == GS_RINGBUFFEREND ) temp = GS_RINGBUFFERBASE; if( temp == GS_RINGBUFFEREND ) temp = GS_RINGBUFFERBASE; \
InterlockedExchangePointer((void**)&g_pGSWritePos, temp); InterlockedExchangePointer((void**)&g_pGSWritePos, temp); \
} }
#if defined(_WIN32) && !defined(WIN32_PTHREADS) #if defined(_WIN32) && !defined(WIN32_PTHREADS)
#define GS_SETEVENT() SetEvent(g_hGsEvent) #define GS_SETEVENT() SetEvent(g_hGsEvent)
#else #else
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
extern sem_t g_semGsThread; extern sem_t g_semGsThread;
#define GS_SETEVENT() sem_post(&g_semGsThread) #define GS_SETEVENT() sem_post(&g_semGsThread)
#endif #endif
u32 GSgifTransferDummy(int path, u32 *pMem, u32 size); u32 GSgifTransferDummy(int path, u32 *pMem, u32 size);
@ -177,45 +184,46 @@ extern int g_SaveGSStream;
extern int g_nLeftGSFrames; extern int g_nLeftGSFrames;
extern gzFile g_fGSSave; extern gzFile g_fGSSave;
static __forceinline void GSGIFTRANSFER1(u32 *pMem, u32 addr) { #define GSGIFTRANSFER1(pMem, addr) { \
if( g_SaveGSStream == 2) { if( g_SaveGSStream == 2) { \
u32 type = GSRUN_TRANS1; int type = GSRUN_TRANS1; \
u32 size = (0x4000-(addr))/16; int size = (0x4000-(addr))/16; \
gzwrite(g_fGSSave, &type, sizeof(type)); gzwrite(g_fGSSave, &type, sizeof(type)); \
gzwrite(g_fGSSave, &size, 4); \ gzwrite(g_fGSSave, &size, 4); \
gzwrite(g_fGSSave, ((u8*)pMem)+(addr), size*16); gzwrite(g_fGSSave, ((u8*)pMem)+(addr), size*16); \
} } \
GSgifTransfer1(pMem, addr); GSgifTransfer1(pMem, addr); \
} }
static __forceinline void GSGIFTRANSFER2(u32 *pMem, u32 size) { #define GSGIFTRANSFER2(pMem, size) { \
if( g_SaveGSStream == 2) { if( g_SaveGSStream == 2) { \
u32 type = GSRUN_TRANS2; int type = GSRUN_TRANS2; \
u32 _size = size; int _size = size; \
gzwrite(g_fGSSave, &type, sizeof(type)); gzwrite(g_fGSSave, &type, sizeof(type)); \
gzwrite(g_fGSSave, &_size, 4); gzwrite(g_fGSSave, &_size, 4); \
gzwrite(g_fGSSave, pMem, _size*16); gzwrite(g_fGSSave, pMem, _size*16); \
} } \
GSgifTransfer2(pMem, size); GSgifTransfer2(pMem, size); \
} }
static __forceinline void GSGIFTRANSFER3(u32 *pMem, u32 size) {
if( g_SaveGSStream == 2 ) { #define GSGIFTRANSFER3(pMem, size) { \
u32 type = GSRUN_TRANS3; if( g_SaveGSStream == 2 ) { \
u32 _size = size; int type = GSRUN_TRANS3; \
gzwrite(g_fGSSave, &type, sizeof(type)); int _size = size; \
gzwrite(g_fGSSave, &_size, 4); gzwrite(g_fGSSave, &type, sizeof(type)); \
gzwrite(g_fGSSave, pMem, _size*16); gzwrite(g_fGSSave, &_size, 4); \
} gzwrite(g_fGSSave, pMem, _size*16); \
GSgifTransfer3(pMem, size); } \
GSgifTransfer3(pMem, size); \
} }
static __forceinline void GSVSYNC(void) { #define GSVSYNC() { \
if( g_SaveGSStream == 2 ) { if( g_SaveGSStream == 2 ) { \
u32 type = GSRUN_VSYNC; int type = GSRUN_VSYNC; \
gzwrite(g_fGSSave, &type, sizeof(type)); gzwrite(g_fGSSave, &type, sizeof(type)); \
} } \
} } \
#else #else