当前位置: 首页>>代码示例>>C++>>正文


C++ StreamType::GetAvailableReadBytes方法代码示例

本文整理汇总了C++中StreamType::GetAvailableReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamType::GetAvailableReadBytes方法的具体用法?C++ StreamType::GetAvailableReadBytes怎么用?C++ StreamType::GetAvailableReadBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StreamType的用法示例。


在下文中一共展示了StreamType::GetAvailableReadBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CGsPacketMetadata

void CVPU1::Cmd_DIRECT(StreamType& stream, CODE nCommand)
{
	uint32 nSize = stream.GetAvailableReadBytes();
	nSize = std::min<uint32>(m_CODE.nIMM * 0x10, nSize);
	assert((nSize & 0x0F) == 0);

	if(nSize != 0)
	{
		uint8* packet = reinterpret_cast<uint8*>(alloca(nSize));
		stream.Read(packet, nSize);

		int32 remainingLength = nSize;
		while(remainingLength > 0)
		{
			uint32 processed = m_vif.GetGif().ProcessPacket(packet, 0, remainingLength, CGsPacketMetadata(2));
			packet += processed;
			remainingLength -= processed;
			assert(remainingLength >= 0);
		}
	}

	m_CODE.nIMM -= (nSize / 0x10);
	if((m_CODE.nIMM == 0) && (nSize != 0))
	{
		m_STAT.nVPS = 0;
	}
	else
	{
		m_STAT.nVPS = 1;
	}
}
开发者ID:RikoudoX,项目名称:Play-,代码行数:31,代码来源:VPU1.cpp

示例2: ProcessPacket

void CVPU::ProcessPacket(StreamType& stream)
{
	while(stream.GetAvailableReadBytes())
	{
		if(m_STAT.nVPS == 1)
		{
			//Command is waiting for more data...
			ExecuteCommand(stream, m_CODE);

			if((m_STAT.nVPS == 1) && (stream.GetAvailableReadBytes() != 0))
			{
				//We have data in our FIFO but we still need more than what's available
				break;
			}
			else
			{
				continue;
			}
		}
		if(m_STAT.nVEW == 1)
		{
			if(IsRunning()) break;
			m_STAT.nVEW = 0;
			//Command is waiting for micro-program to end.
			ExecuteCommand(stream, m_CODE);
			continue;
		}

#ifdef DELAYED_MSCAL
		m_previousCODE = m_CODE;
#endif
		stream.Read(&m_CODE, sizeof(CODE));

		assert(m_CODE.nI == 0);

		m_NUM = m_CODE.nNUM;

		ExecuteCommand(stream, m_CODE);
	}

#ifdef DELAYED_MSCAL
	if(stream.GetAvailableReadBytes() == 0)
	{
		ResumeDelayedMicroProgram();
	}
#endif
}
开发者ID:cmexp,项目名称:Play-,代码行数:47,代码来源:VPU.cpp

示例3:

bool CVPU::Unpack_V32(StreamType& stream, uint128& result, unsigned int fields)
{
	if(stream.GetAvailableReadBytes() < (fields * 4)) return false;

	stream.Read(&result, (fields * 4));

	return true;
}
开发者ID:cmexp,项目名称:Play-,代码行数:8,代码来源:VPU.cpp

示例4: Cmd_MPG

void CVPU::Cmd_MPG(StreamType& stream, CODE nCommand)
{
	uint32 nSize = stream.GetAvailableReadBytes();

	uint32 nNum			= (m_NUM == 0) ? (256) : (m_NUM);
	uint32 nCodeNum		= (m_CODE.nNUM == 0) ? (256) : (m_CODE.nNUM);
	uint32 nTransfered	= (nCodeNum - nNum) * 8;

	nCodeNum *= 8;
	nNum *= 8;

	nSize = std::min<uint32>(nNum, nSize);

	uint32 nDstAddr = (m_CODE.nIMM * 8) + nTransfered;

	//Check if microprogram is running
	if(IsRunning())
	{
		m_STAT.nVEW = 1;
		return;
	}

	if(nSize != 0)
	{
		uint8* microProgram = reinterpret_cast<uint8*>(alloca(nSize));
		stream.Read(microProgram, nSize);

		//Check if there's a change
		if(memcmp(m_microMem + nDstAddr, microProgram, nSize) != 0)
		{
			m_executor.ClearActiveBlocks();
			memcpy(m_microMem + nDstAddr, microProgram, nSize);
		}
	}

	m_NUM -= static_cast<uint8>(nSize / 8);
	if((m_NUM == 0) && (nSize != 0))
	{
		m_STAT.nVPS = 0;
	}
	else
	{
		m_STAT.nVPS = 1;
	}
}
开发者ID:cmexp,项目名称:Play-,代码行数:45,代码来源:VPU.cpp

示例5: Cmd_STMASK

void CVPU::Cmd_STMASK(StreamType& stream, CODE command)
{
	if(m_NUM == 0)
	{
		m_NUM = 1;
	}

	while(m_NUM != 0 && stream.GetAvailableReadBytes())
	{
		stream.Read(&m_MASK, 4);
		m_NUM--;
	}

	if(m_NUM == 0)
	{
		m_STAT.nVPS = 0;
	}
	else
	{
		m_STAT.nVPS = 1;
	}
}
开发者ID:cmexp,项目名称:Play-,代码行数:22,代码来源:VPU.cpp

示例6: Cmd_STCOL

void CVPU::Cmd_STCOL(StreamType& stream, CODE nCommand)
{
	if(m_NUM == 0)
	{
		m_NUM = 4;
	}

	while(m_NUM != 0 && stream.GetAvailableReadBytes())
	{
		assert(m_NUM <= 4);
		stream.Read(&m_C[4 - m_NUM], 4);
		m_NUM--;
	}

	if(m_NUM == 0)
	{
		m_STAT.nVPS = 0;
	}
	else
	{
		m_STAT.nVPS = 1;
	}
}
开发者ID:cmexp,项目名称:Play-,代码行数:23,代码来源:VPU.cpp

示例7: assert

void CVif1::Cmd_DIRECT(StreamType& stream, CODE nCommand)
{
    uint32 nSize = stream.GetAvailableReadBytes();
    nSize = std::min<uint32>(m_CODE.nIMM * 0x10, nSize);
    assert((nSize & 0x0F) == 0);

    if(nSize != 0)
    {
        if(m_directBuffer.size() < nSize)
        {
            m_directBuffer.resize(nSize);
        }

        auto packet = m_directBuffer.data();
        stream.Read(packet, nSize);

        int32 remainingLength = nSize;
        while(remainingLength > 0)
        {
            uint32 processed = m_gif.ProcessPacket(packet, 0, remainingLength, CGsPacketMetadata(2));
            packet += processed;
            remainingLength -= processed;
            assert(remainingLength >= 0);
        }
    }

    m_CODE.nIMM -= (nSize / 0x10);
    if((m_CODE.nIMM == 0) && (nSize != 0))
    {
        m_STAT.nVPS = 0;
    }
    else
    {
        m_STAT.nVPS = 1;
    }
}
开发者ID:unpeng,项目名称:Play-,代码行数:36,代码来源:Vif1.cpp

示例8: Cmd_UNPACK

void CVPU::Cmd_UNPACK(StreamType& stream, CODE nCommand, uint32 nDstAddr)
{
	assert((nCommand.nCMD & 0x60) == 0x60);

	bool usn = (m_CODE.nIMM & 0x4000) != 0;
	bool useMask = (nCommand.nCMD & 0x10) != 0;
	uint32 cl = m_CYCLE.nCL;
	uint32 wl = m_CYCLE.nWL;

	if(m_NUM == nCommand.nNUM)
	{
		m_readTick = 0;
		m_writeTick = 0;
	}

	uint32 currentNum = (m_NUM == 0) ? 256 : m_NUM;
	uint32 codeNum = (m_CODE.nNUM == 0) ? 256 : m_CODE.nNUM;
	uint32 transfered = codeNum - currentNum;
	assert(transfered == 0 || cl == wl);	//The value above is only valid for specific combinations of cl and wl

	nDstAddr += transfered;
	nDstAddr *= 0x10;

	uint128* dst = reinterpret_cast<uint128*>(&m_vuMem[nDstAddr]);

	while((currentNum != 0) && stream.GetAvailableReadBytes())
	{
		bool mustWrite = false;
		uint128 writeValue;
		memset(&writeValue, 0, sizeof(writeValue));

		if(cl >= wl)
		{
			if(m_readTick < wl || wl == 0)
			{
				bool success = Unpack_ReadValue(nCommand, stream, writeValue, usn);
				if(!success) break;
				mustWrite = true;
			}
		}
		else
		{
			if(m_writeTick < cl)
			{
				bool success = Unpack_ReadValue(nCommand, stream, writeValue, usn);
				if(!success) break;
			}

			mustWrite = true;
		}

		if(mustWrite)
		{
			for(unsigned int i = 0; i < 4; i++)
			{
				uint32 maskOp = useMask ? GetMaskOp(i, m_writeTick) : MASK_DATA;

				if(maskOp == MASK_DATA)
				{
					if(m_MODE == MODE_OFFSET)
					{
						writeValue.nV[i] += m_R[i];
					}
					else if(m_MODE == MODE_DIFFERENCE)
					{
						assert(0);
					}

					dst->nV[i] = writeValue.nV[i];
				}
				else if(maskOp == MASK_ROW)
				{
					dst->nV[i] = m_R[i];
				}
				else if(maskOp == MASK_COL)
				{
					int index = (m_writeTick > 3) ? 3 : m_writeTick;
					dst->nV[i] = m_C[index];
				}
				else if(maskOp == MASK_MASK)
				{
					//Don't write anything
				}
				else
				{
					assert(0);
				}
			}
			
			currentNum--;
		}

		if(cl >= wl)
		{
			m_writeTick = std::min<uint32>(m_writeTick + 1, wl);
			m_readTick = std::min<uint32>(m_readTick + 1, cl);

			if(m_readTick == cl)
			{
				m_writeTick = 0;
//.........这里部分代码省略.........
开发者ID:cmexp,项目名称:Play-,代码行数:101,代码来源:VPU.cpp


注:本文中的StreamType::GetAvailableReadBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。