mirror of
https://github.com/libAthena/athena.git
synced 2025-07-05 04:35:55 +00:00
* Fix LZO
This commit is contained in:
parent
2fa715cbbf
commit
6187eb3f77
@ -35,8 +35,8 @@ atInt32 decompressLZO(const atUint8* source, atInt32 sourceSize, atUint8* dst, a
|
|||||||
atUint32 yaz0Decode(const atUint8* src, atUint8*& dst, atUint32 uncompressedSize);
|
atUint32 yaz0Decode(const atUint8* src, atUint8*& dst, atUint32 uncompressedSize);
|
||||||
atUint32 yaz0Encode(const atUint8* src, atUint32 srcSize, atUint8* data);
|
atUint32 yaz0Encode(const atUint8* src, atUint32 srcSize, atUint8* data);
|
||||||
|
|
||||||
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst);
|
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst);
|
||||||
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst, bool extended = false);
|
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ public:
|
|||||||
explicit LZBase(atInt32 minimumOffset=1,atInt32 slidingWindow=4096, atInt32 minimumMatch=3, atInt32 blockSize=8);
|
explicit LZBase(atInt32 minimumOffset=1,atInt32 slidingWindow=4096, atInt32 minimumMatch=3, atInt32 blockSize=8);
|
||||||
virtual ~LZBase() {}
|
virtual ~LZBase() {}
|
||||||
|
|
||||||
virtual atUint32 compress(const atUint8* src, atUint8*& dest, atUint32 srcLength)=0;
|
virtual atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength)=0;
|
||||||
virtual atUint32 decompress(const atUint8* src, atUint8*& dest, atUint32 srcLength)=0;
|
virtual atUint32 decompress(const atUint8* src, atUint8** dest, atUint32 srcLength)=0;
|
||||||
|
|
||||||
void setSlidingWindow(atInt32 SlidingWindow);
|
void setSlidingWindow(atInt32 SlidingWindow);
|
||||||
atInt32 slidingWindow();
|
atInt32 slidingWindow();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
class LZType10 : public LZBase {
|
class LZType10 : public LZBase {
|
||||||
public:
|
public:
|
||||||
explicit LZType10(atInt32 minimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8);
|
explicit LZType10(atInt32 minimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8);
|
||||||
atUint32 compress(const atUint8* src, atUint8*& dest, atUint32 srcLength);
|
atUint32 compress(const atUint8* src, atUint8** dest, atUint32 srcLength);
|
||||||
atUint32 decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen);
|
atUint32 decompress(const atUint8* src, atUint8** dst, atUint32 srcLen);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LZ77TYPE10_HPP
|
#endif // LZ77TYPE10_HPP
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
class LZType11 : public LZBase {
|
class LZType11 : public LZBase {
|
||||||
public:
|
public:
|
||||||
explicit LZType11(atInt32 MinimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8);
|
explicit LZType11(atInt32 MinimumOffset=1, atInt32 SlidingWindow=4096, atInt32 MinimumMatch=3, atInt32 BlockSize=8);
|
||||||
atUint32 compress(const atUint8 *src, atUint8*& dest, atUint32 srcLength);
|
atUint32 compress(const atUint8 *src, atUint8** dest, atUint32 srcLength);
|
||||||
atUint32 decompress(const atUint8 *src, atUint8*& dest, atUint32 srcLength);
|
atUint32 decompress(const atUint8 *src, atUint8** dest, atUint32 srcLength);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ atUint32 simpleEnc(const atUint8* src, atInt32 size, atInt32 pos, atUint32 *pMat
|
|||||||
return numBytes;
|
return numBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst)
|
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst)
|
||||||
{
|
{
|
||||||
LZBase* lzCodec;
|
LZBase* lzCodec;
|
||||||
if (*(atUint8*)src == 0x11)
|
if (*(atUint8*)src == 0x11)
|
||||||
@ -340,7 +340,7 @@ atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst)
|
|||||||
return retLength;
|
return retLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8* dst, bool extended)
|
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended)
|
||||||
{
|
{
|
||||||
LZBase* lzCodec;
|
LZBase* lzCodec;
|
||||||
if (extended)
|
if (extended)
|
||||||
|
@ -11,7 +11,7 @@ LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 Minimum
|
|||||||
m_readAheadBuffer = m_minMatch + 0xF;
|
m_readAheadBuffer = m_minMatch + 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 LZType10::compress(const atUint8* src, atUint8*& dstBuf, atUint32 srcLength)
|
atUint32 LZType10::compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength)
|
||||||
{
|
{
|
||||||
atUint32 encodeSize=(srcLength<<8)|(0x10);
|
atUint32 encodeSize=(srcLength<<8)|(0x10);
|
||||||
encodeSize = Athena::utility::LittleUint32(encodeSize); //File size needs to be written as little endian always
|
encodeSize = Athena::utility::LittleUint32(encodeSize); //File size needs to be written as little endian always
|
||||||
@ -65,12 +65,12 @@ atUint32 LZType10::compress(const atUint8* src, atUint8*& dstBuf, atUint32 srcLe
|
|||||||
while ((outbuf.position()%4) !=0 )
|
while ((outbuf.position()%4) !=0 )
|
||||||
outbuf.writeByte(0);
|
outbuf.writeByte(0);
|
||||||
|
|
||||||
dstBuf = outbuf.data();
|
*dstBuf = outbuf.data();
|
||||||
outbuf.save();
|
outbuf.save();
|
||||||
return outbuf.length();
|
return outbuf.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 LZType10::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLength)
|
atUint32 LZType10::decompress(const atUint8* src, atUint8** dst, atUint32 srcLength)
|
||||||
{
|
{
|
||||||
if (*(atUint8*)(src) != 0x10)
|
if (*(atUint8*)(src) != 0x10)
|
||||||
return 0;
|
return 0;
|
||||||
@ -128,7 +128,7 @@ atUint32 LZType10::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = uncompressedData;
|
*dst = uncompressedData;
|
||||||
|
|
||||||
return uncompressedSize;
|
return uncompressedSize;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ LZType11::LZType11(atInt32 minimumOffset, atInt32 slidingWindow, atInt32 minimum
|
|||||||
m_lookupTable.setLookAheadWindow(m_readAheadBuffer);
|
m_lookupTable.setLookAheadWindow(m_readAheadBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 LZType11::compress(const atUint8* src, atUint8*& dst, atUint32 srcLength)
|
atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLength)
|
||||||
{
|
{
|
||||||
Athena::io::BinaryWriter outbuff("tmp");
|
Athena::io::BinaryWriter outbuff("tmp");
|
||||||
if (srcLength>0xFFFFFF){// If length is greater than 24 bits or 16 Megs
|
if (srcLength>0xFFFFFF){// If length is greater than 24 bits or 16 Megs
|
||||||
@ -113,11 +113,11 @@ atUint32 LZType11::compress(const atUint8* src, atUint8*& dst, atUint32 srcLengt
|
|||||||
while((outbuff.position()%4) !=0 )
|
while((outbuff.position()%4) !=0 )
|
||||||
outbuff.writeByte(0);
|
outbuff.writeByte(0);
|
||||||
|
|
||||||
dst = outbuff.data();
|
*dst = outbuff.data();
|
||||||
return outbuff.length();
|
return outbuff.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint32 LZType11::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLength)
|
atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLength)
|
||||||
{
|
{
|
||||||
if(*(atUint8*)(src) != 0x11)
|
if(*(atUint8*)(src) != 0x11)
|
||||||
return 0;
|
return 0;
|
||||||
@ -207,7 +207,7 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8*& dst, atUint32 srcLen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = uncompressedData;
|
*dst = uncompressedData;
|
||||||
return uncompressedLen;
|
return uncompressedLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user