本文整理汇总了C++中StreamType::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamType::Read方法的具体用法?C++ StreamType::Read怎么用?C++ StreamType::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamType
的用法示例。
在下文中一共展示了StreamType::Read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2:
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;
}
示例3: 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
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}