mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
This is an experimental release, as such it is posted only to Google Code. Changelog: - 21fx API moved to pre-finalized form as S-MSU1; more about this on the forum - OpenGL driver now uses GL_CLAMP_TO_BORDER instead of GL_CLAMP_TO_EDGE to support screen curvature shader - rewrote file open dialog; code is greatly simplified, interface is improved - all cheat code columns are now enquoted, and empty codes at the bottom of the file are omitted (format is compatible with previous releases still) - debugger: added missing DMA variables to S-CPU properties viewer - snesfilter: added OpenMP (multi-threading) support to HQ2x filter - lots of other miscellaneous code cleanup work
86 lines
1.1 KiB
C++
86 lines
1.1 KiB
C++
#include "rar.hpp"
|
|
|
|
RawRead::RawRead(ComprDataIO *SrcFile) : Data( SrcFile )
|
|
{
|
|
RawRead::SrcFile=SrcFile;
|
|
ReadPos=0;
|
|
DataSize=0;
|
|
}
|
|
|
|
void RawRead::Reset()
|
|
{
|
|
ReadPos=0;
|
|
DataSize=0;
|
|
Data.Reset();
|
|
}
|
|
|
|
void RawRead::Read(int Size)
|
|
{
|
|
// (removed decryption)
|
|
if (Size!=0)
|
|
{
|
|
Data.Add(Size);
|
|
DataSize+=SrcFile->Read(&Data[DataSize],Size);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
void RawRead::Get(byte &Field)
|
|
{
|
|
if (ReadPos<DataSize)
|
|
{
|
|
Field=Data[ReadPos];
|
|
ReadPos++;
|
|
}
|
|
else
|
|
Field=0;
|
|
}
|
|
|
|
|
|
void RawRead::Get(ushort &Field)
|
|
{
|
|
if (ReadPos+1<DataSize)
|
|
{
|
|
Field=Data[ReadPos]+(Data[ReadPos+1]<<8);
|
|
ReadPos+=2;
|
|
}
|
|
else
|
|
Field=0;
|
|
}
|
|
|
|
|
|
void RawRead::Get(uint &Field)
|
|
{
|
|
if (ReadPos+3<DataSize)
|
|
{
|
|
Field=Data[ReadPos]+(Data[ReadPos+1]<<8)+(Data[ReadPos+2]<<16)+
|
|
(Data[ReadPos+3]<<24);
|
|
ReadPos+=4;
|
|
}
|
|
else
|
|
Field=0;
|
|
}
|
|
|
|
|
|
|
|
|
|
void RawRead::Get(byte *Field,int Size)
|
|
{
|
|
if (ReadPos+Size-1<DataSize)
|
|
{
|
|
memcpy(Field,&Data[ReadPos],Size);
|
|
ReadPos+=Size;
|
|
}
|
|
else
|
|
memset(Field,0,Size);
|
|
}
|
|
|
|
|
|
|
|
|
|
uint RawRead::GetCRC(bool ProcessedOnly)
|
|
{
|
|
return(DataSize>2 ? CRC(0xffffffff,&Data[2],(ProcessedOnly ? ReadPos:DataSize)-2):0xffffffff);
|
|
}
|