Removed two redundant/unneeded conditional checks from GIFpath processing.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1912 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-09-23 12:17:53 +00:00
parent 5ad7b00261
commit 32550ef6a0
1 changed files with 27 additions and 12 deletions

View File

@ -102,11 +102,11 @@ struct GIFPath
int ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size); int ParseTag(GIF_PATH pathidx, const u8* pMem, u32 size);
}; };
typedef void (*GIFRegHandler)(const u32* data); typedef void (__fastcall *GIFRegHandler)(const u32* data);
struct GifPathStruct struct GifPathStruct
{ {
const GIFRegHandler Handlers[3]; const GIFRegHandler Handlers[0x100-0x60]; // handlers for 0x60->0x100
GIFPath path[3]; GIFPath path[3];
__forceinline GIFPath& operator[]( int idx ) { return path[idx]; } __forceinline GIFPath& operator[]( int idx ) { return path[idx]; }
@ -130,7 +130,7 @@ struct GifPathStruct
// raised once the EE has reset the *IMR* mask for SIGNAL -- meaning setting the bit to 1 // raised once the EE has reset the *IMR* mask for SIGNAL -- meaning setting the bit to 1
// (disabled/masked) and then back to 0 (enabled/unmasked). // (disabled/masked) and then back to 0 (enabled/unmasked).
// //
static void RegHandlerSIGNAL(const u32* data) static void __fastcall RegHandlerSIGNAL(const u32* data)
{ {
GIF_LOG("MTGS SIGNAL data %x_%x CSRw %x IMR %x CSRr\n",data[0], data[1], CSRw, GSIMR, GSCSRr); GIF_LOG("MTGS SIGNAL data %x_%x CSRw %x IMR %x CSRr\n",data[0], data[1], CSRw, GSIMR, GSCSRr);
@ -156,7 +156,7 @@ static void RegHandlerSIGNAL(const u32* data)
// However! We should properly emulate handling partial-DMA transfers on PATH2 and // However! We should properly emulate handling partial-DMA transfers on PATH2 and
// PATH3 of the GIF, which means only signaling FINISH if nloop==0. // PATH3 of the GIF, which means only signaling FINISH if nloop==0.
// //
static void RegHandlerFINISH(const u32* data) static void __fastcall RegHandlerFINISH(const u32* data)
{ {
GIF_LOG("GIFpath FINISH data %x_%x CSRw %x\n", data[0], data[1], CSRw); GIF_LOG("GIFpath FINISH data %x_%x CSRw %x\n", data[0], data[1], CSRw);
@ -169,15 +169,28 @@ static void RegHandlerFINISH(const u32* data)
} }
} }
static void RegHandlerLABEL(const u32* data) static void __fastcall RegHandlerLABEL(const u32* data)
{ {
GIF_LOG( "GIFpath LABEL" ); GIF_LOG( "GIFpath LABEL" );
GSSIGLBLID.LBLID = (GSSIGLBLID.LBLID&~data[1])|(data[0]&data[1]); GSSIGLBLID.LBLID = (GSSIGLBLID.LBLID&~data[1])|(data[0]&data[1]);
} }
static void __fastcall RegHandlerUNMAPPED(const u32* data)
{
Console::Notice( "Unmapped GIFtag Register Index: Ignoring." );
}
#define INSERT_UNMAPPED_4 RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED, RegHandlerUNMAPPED,
#define INSERT_UNMAPPED_16 INSERT_UNMAPPED_4 INSERT_UNMAPPED_4 INSERT_UNMAPPED_4 INSERT_UNMAPPED_4
#define INSERT_UNMAPPED_64 INSERT_UNMAPPED_16 INSERT_UNMAPPED_16 INSERT_UNMAPPED_16 INSERT_UNMAPPED_16
PCSX2_ALIGNED16( static GifPathStruct s_gifPath ) = PCSX2_ALIGNED16( static GifPathStruct s_gifPath ) =
{ {
RegHandlerSIGNAL, RegHandlerFINISH, RegHandlerLABEL RegHandlerSIGNAL, RegHandlerFINISH, RegHandlerLABEL, RegHandlerUNMAPPED,
// Rest are mapped to Unmapped
INSERT_UNMAPPED_4 INSERT_UNMAPPED_4 INSERT_UNMAPPED_4
INSERT_UNMAPPED_64 INSERT_UNMAPPED_64 INSERT_UNMAPPED_16
}; };
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -240,16 +253,18 @@ void SaveStateBase::gifPathFreeze()
static __forceinline void gsHandler(const u8* pMem) { static __forceinline void gsHandler(const u8* pMem) {
const int handler = pMem[8]; const int handler = pMem[8];
if (handler >= 0x60 && handler < 0x63) { if (handler >= 0x60) {
//DevCon::Status("GIF Tag Interrupt"); // Question: What happens if an app writes to uncharted register space
// on real PS2 hardware (handler 0x63 and higher)? Probably a silent
// ignorance, but not tested so just guessing... --air
s_gifPath.Handlers[handler&0x3]((const u32*)pMem); s_gifPath.Handlers[handler&0x3]((const u32*)pMem);
} }
} }
#define incTag(x, y) do { \ #define incTag(x, y) do { \
pMem += (x); \ pMem += (x); \
size -= (y); \ size -= (y); \
if ((pathidx==GIF_PATH_1)&&(pMem>=vuMemEnd)) pMem -= 0x4000; \ if (pMem>=vuMemEnd) pMem -= 0x4000; \
} while(false) } while(false)
#define aMin(x, y) ((x < y) ? (x) : (y)) #define aMin(x, y) ((x < y) ? (x) : (y))