mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 19:45:07 +00:00
A little Delphine unpacker documentation addition and variable renaming.
svn-id: r32660
This commit is contained in:
parent
235504e600
commit
efc4fd7ae0
@ -36,23 +36,23 @@ uint32 CineUnpacker::readSource() {
|
||||
return value;
|
||||
}
|
||||
|
||||
int CineUnpacker::rcr(int CF) {
|
||||
int rCF = (_chk & 1);
|
||||
_chk >>= 1;
|
||||
if (CF) {
|
||||
_chk |= 0x80000000;
|
||||
int CineUnpacker::rcr(int inputCarry) {
|
||||
int outputCarry = (_chunk32b & 1);
|
||||
_chunk32b >>= 1;
|
||||
if (inputCarry) {
|
||||
_chunk32b |= 0x80000000;
|
||||
}
|
||||
return rCF;
|
||||
return outputCarry;
|
||||
}
|
||||
|
||||
int CineUnpacker::nextBit() {
|
||||
int CF = rcr(0);
|
||||
if (_chk == 0) {
|
||||
_chk = readSource();
|
||||
_crc ^= _chk;
|
||||
CF = rcr(1);
|
||||
int carry = rcr(0);
|
||||
if (_chunk32b == 0) {
|
||||
_chunk32b = readSource();
|
||||
_crc ^= _chunk32b;
|
||||
carry = rcr(1);
|
||||
}
|
||||
return CF;
|
||||
return carry;
|
||||
}
|
||||
|
||||
uint16 CineUnpacker::getBits(byte numBits) {
|
||||
@ -85,8 +85,8 @@ bool CineUnpacker::unpack(byte *dst, const byte *src, int srcLen) {
|
||||
_datasize = readSource();
|
||||
_dst = dst + _datasize - 1;
|
||||
_crc = readSource();
|
||||
_chk = readSource();
|
||||
_crc ^= _chk;
|
||||
_chunk32b = readSource();
|
||||
_crc ^= _chunk32b;
|
||||
do {
|
||||
if (!nextBit()) {
|
||||
if (!nextBit()) {
|
||||
|
@ -38,7 +38,13 @@ public:
|
||||
private:
|
||||
/** Reads a single big endian 32-bit integer from the source and goes backwards 4 bytes. */
|
||||
uint32 readSource();
|
||||
int rcr(int CF);
|
||||
|
||||
/**
|
||||
* Shifts the current internal 32-bit chunk to the right by one.
|
||||
* Puts input carry into internal chunk's topmost (i.e. leftmost) bit.
|
||||
* Returns the least significant bit that was shifted out.
|
||||
*/
|
||||
int rcr(int inputCarry);
|
||||
int nextBit();
|
||||
uint16 getBits(byte numBits);
|
||||
void unpackBytes(uint16 numBytes);
|
||||
@ -46,7 +52,7 @@ private:
|
||||
private:
|
||||
int _datasize;
|
||||
uint32 _crc;
|
||||
uint32 _chk;
|
||||
uint32 _chunk32b; //!< The current internal 32-bit chunk
|
||||
byte *_dst;
|
||||
const byte *_src;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user