Removed the TestOnly parameter on the MTGS packet sender, and replaced it with a direct call to GIFPath_ParseTag. Simpler, more efficient, and avoids constant assertion failures when running PCSX2 in debug mode. :D

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3275 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-06-23 01:13:01 +00:00
parent 26fece9510
commit d24a15e0f9
8 changed files with 17 additions and 18 deletions

View File

@ -191,7 +191,7 @@ void __fastcall WriteFIFO_page_6(u32 mem, const mem128_t *value)
nloop0_packet[3] = psHu32(GIF_FIFO + 12); nloop0_packet[3] = psHu32(GIF_FIFO + 12);
Registers::Freeze(); Registers::Freeze();
gifRegs->stat.APATH = GIF_APATH3; gifRegs->stat.APATH = GIF_APATH3;
GetMTGS().PrepDataPacket(GIF_PATH_3, nloop0_packet, 1, false); GetMTGS().PrepDataPacket(GIF_PATH_3, nloop0_packet, 1);
u64* data = (u64*)GetMTGS().GetDataPacketPtr(); u64* data = (u64*)GetMTGS().GetDataPacketPtr();
data[0] = value[0]; data[0] = value[0];
data[1] = value[1]; data[1] = value[1];

View File

@ -252,8 +252,8 @@ public:
void WaitGS(); void WaitGS();
void ResetGS(); void ResetGS();
int PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size, bool TestOnly ); int PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size );
int PrepDataPacket( GIF_PATH pathidx, const u32* srcdata, u32 size, bool TestOnly ); int PrepDataPacket( GIF_PATH pathidx, const u32* srcdata, u32 size );
void SendDataPacket(); void SendDataPacket();
void SendGameCRC( u32 crc ); void SendGameCRC( u32 crc );
void WaitForOpen(); void WaitForOpen();

View File

@ -59,7 +59,7 @@ void gsPath1Interrupt()
if((gifRegs->stat.APATH == GIF_APATH_IDLE || gifRegs->stat.APATH == GIF_APATH1) && Path1WritePos > 0 && !gifRegs->stat.PSE) if((gifRegs->stat.APATH == GIF_APATH_IDLE || gifRegs->stat.APATH == GIF_APATH1) && Path1WritePos > 0 && !gifRegs->stat.PSE)
{ {
Registers::Freeze(); Registers::Freeze();
u32 size = GetMTGS().PrepDataPacket(GIF_PATH_1, Path1Buffer + (Path1ReadPos*16), (Path1WritePos - Path1ReadPos), false); u32 size = GetMTGS().PrepDataPacket(GIF_PATH_1, Path1Buffer + (Path1ReadPos*16), (Path1WritePos - Path1ReadPos));
u8* pDest = GetMTGS().GetDataPacketPtr(); u8* pDest = GetMTGS().GetDataPacketPtr();
//DevCon.Warning("Flush Size = %x", size); //DevCon.Warning("Flush Size = %x", size);
@ -128,7 +128,7 @@ __forceinline void gsInterrupt()
static u32 WRITERING_DMA(u32 *pMem, u32 qwc) static u32 WRITERING_DMA(u32 *pMem, u32 qwc)
{ {
int size = GetMTGS().PrepDataPacket(GIF_PATH_3, pMem, qwc, false); int size = GetMTGS().PrepDataPacket(GIF_PATH_3, pMem, qwc);
u8* pgsmem = GetMTGS().GetDataPacketPtr(); u8* pgsmem = GetMTGS().GetDataPacketPtr();
memcpy_aligned(pgsmem, pMem, size<<4); memcpy_aligned(pgsmem, pMem, size<<4);

View File

@ -594,9 +594,9 @@ void SysMtgsThread::SendDataPacket()
//m_PacketLocker.Release(); //m_PacketLocker.Release();
} }
int SysMtgsThread::PrepDataPacket( GIF_PATH pathidx, const u32* srcdata, u32 size, bool TestOnly ) int SysMtgsThread::PrepDataPacket( GIF_PATH pathidx, const u32* srcdata, u32 size )
{ {
return PrepDataPacket( pathidx, (u8*)srcdata, size, TestOnly ); return PrepDataPacket( pathidx, (u8*)srcdata, size );
} }
#ifdef PCSX2_GSRING_TX_STATS #ifdef PCSX2_GSRING_TX_STATS
@ -614,7 +614,7 @@ static u32 ringtx_inf_s[32];
// around VU memory instead of having buffer overflow... // around VU memory instead of having buffer overflow...
// Parameters: // Parameters:
// size - size of the packet data, in smd128's // size - size of the packet data, in smd128's
int SysMtgsThread::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size, bool TestOnly ) int SysMtgsThread::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size )
{ {
//m_PacketLocker.Acquire(); //m_PacketLocker.Acquire();
@ -674,8 +674,7 @@ int SysMtgsThread::PrepDataPacket( GIF_PATH pathidx, const u8* srcdata, u32 size
pxAssert( size < RingBufferSize ); pxAssert( size < RingBufferSize );
pxAssert( writepos < RingBufferSize ); pxAssert( writepos < RingBufferSize );
m_packet_size = GIFPath_ParseTag(pathidx, srcdata, size, TestOnly); m_packet_size = GIFPath_ParseTag(pathidx, srcdata, size, false);
if( TestOnly == true) return m_packet_size;
size = m_packet_size + 1; // takes into account our command qword. size = m_packet_size + 1; // takes into account our command qword.
if( writepos + size < RingBufferSize ) if( writepos + size < RingBufferSize )

View File

@ -2057,7 +2057,7 @@ void _vuXGKICK(VURegs * VU)
u8* data = ((u8*)VU->Mem + ((VU->VI[_Is_].US[0]*16) & 0x3fff)); u8* data = ((u8*)VU->Mem + ((VU->VI[_Is_].US[0]*16) & 0x3fff));
u32 size; u32 size;
size = GetMTGS().PrepDataPacket( GIF_PATH_1, data, (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)) >> 4, false); size = GetMTGS().PrepDataPacket( GIF_PATH_1, data, (0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)) >> 4);
u8* pmem = GetMTGS().GetDataPacketPtr(); u8* pmem = GetMTGS().GetDataPacketPtr();
if((size << 4) > (u32)(0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff))) if((size << 4) > (u32)(0x4000-((VU->VI[_Is_].US[0]*16) & 0x3fff)))

View File

@ -205,7 +205,7 @@ template<int idx> _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) {
v.bSize = 0; v.bSize = 0;
v.bPtr = 0; v.bPtr = 0;
} }
const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, v.buffer, 1, false); const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, v.buffer, 1);
memcpy_fast(GetMTGS().GetDataPacketPtr(), v.buffer, count << 4); memcpy_fast(GetMTGS().GetDataPacketPtr(), v.buffer, count << 4);
GetMTGS().SendDataPacket(); GetMTGS().SendDataPacket();
@ -219,7 +219,7 @@ template<int idx> _f int _vifCode_Direct(int pass, u8* data, bool isDirectHL) {
} }
else else
{ {
const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, data, size >> 4, false); const uint count = GetMTGS().PrepDataPacket(GIF_PATH_2, data, size >> 4);
memcpy_fast(GetMTGS().GetDataPacketPtr(), data, count << 4); memcpy_fast(GetMTGS().GetDataPacketPtr(), data, count << 4);
GetMTGS().SendDataPacket(); GetMTGS().SendDataPacket();
vif1.tag.size -= count << 2; vif1.tag.size -= count << 2;

View File

@ -1112,7 +1112,7 @@ void __fastcall mVU_XGKICK_(u32 addr) {
if(gifRegs->stat.APATH == GIF_APATH_IDLE) if(gifRegs->stat.APATH == GIF_APATH_IDLE)
{ {
size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff, false); size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff);
pDest = GetMTGS().GetDataPacketPtr(); pDest = GetMTGS().GetDataPacketPtr();
if (size > diff) { if (size > diff) {
// fixme: one of these days the following *16's will get cleaned up when we introduce // fixme: one of these days the following *16's will get cleaned up when we introduce
@ -1131,11 +1131,11 @@ void __fastcall mVU_XGKICK_(u32 addr) {
else else
{ {
//DevCon.Warning("GIF APATH busy %x Holding for later W %x, R %x", gifRegs->stat.APATH, Path1WritePos, Path1ReadPos); //DevCon.Warning("GIF APATH busy %x Holding for later W %x, R %x", gifRegs->stat.APATH, Path1WritePos, Path1ReadPos);
size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff, true); size = GIFPath_ParseTag(GIF_PATH_1, data, diff, true);
pDest = &Path1Buffer[Path1WritePos*16]; pDest = &Path1Buffer[Path1WritePos*16];
//DevCon.Warning("Storing size %x PATH 1", size); //DevCon.Warning("Storing size %x PATH 1", size);
if (size > diff) { if (size > diff) {
// fixme: one of these days the following *16's will get cleaned up when we introduce // fixme: one of these days the following *16's will get cleaned up when we introduce

View File

@ -1980,7 +1980,7 @@ void __fastcall VU1XGKICK_MTGSTransfer(u32 *pMem, u32 addr)
if(gifRegs->stat.APATH == GIF_APATH_IDLE) if(gifRegs->stat.APATH == GIF_APATH_IDLE)
{ {
size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff, false); size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff);
pDest = GetMTGS().GetDataPacketPtr(); pDest = GetMTGS().GetDataPacketPtr();
if (size > diff) { if (size > diff) {
// fixme: one of these days the following *16's will get cleaned up when we introduce // fixme: one of these days the following *16's will get cleaned up when we introduce
@ -1999,7 +1999,7 @@ void __fastcall VU1XGKICK_MTGSTransfer(u32 *pMem, u32 addr)
else else
{ {
//DevCon.Warning("GIF APATH busy %x Holding for later W %x, R %x", gifRegs->stat.APATH, Path1WritePos, Path1ReadPos); //DevCon.Warning("GIF APATH busy %x Holding for later W %x, R %x", gifRegs->stat.APATH, Path1WritePos, Path1ReadPos);
size = GetMTGS().PrepDataPacket(GIF_PATH_1, data, diff, true); size = GIFPath_ParseTag(GIF_PATH_1, data, diff, true);
pDest = &Path1Buffer[Path1WritePos*16]; pDest = &Path1Buffer[Path1WritePos*16];