Improved LZMA library.
This commit is contained in:
@@ -209,11 +209,12 @@ ${CHIPDIR}/sa1proc.o: ${CHIPDIR}/sa1proc.asm macros.mac
|
|||||||
endmem.o: endmem.asm macros.mac
|
endmem.o: endmem.asm macros.mac
|
||||||
${DOSDIR}/modemrtn.o: ${DOSDIR}/modemrtn.asm macros.mac
|
${DOSDIR}/modemrtn.o: ${DOSDIR}/modemrtn.asm macros.mac
|
||||||
|
|
||||||
${JMADIR}/7zlzma.o: ${JMADIR}/7zlzma.cpp ${JMADIR}/iiostrm.h
|
${JMADIR}/7zlzma.o: ${JMADIR}/7zlzma.cpp ${JMADIR}/7z.h ${JMADIR}/iiostrm.h
|
||||||
${JMADIR}/crc32.o: ${JMADIR}/crc32.cpp ${JMADIR}/crc32.h
|
${JMADIR}/crc32.o: ${JMADIR}/crc32.cpp ${JMADIR}/crc32.h
|
||||||
${JMADIR}/iiostrm.o: ${JMADIR}/iiostrm.cpp ${JMADIR}/iiostrm.h ${JMADIR}/crc32.h
|
${JMADIR}/iiostrm.o: ${JMADIR}/iiostrm.cpp ${JMADIR}/iiostrm.h ${JMADIR}/crc32.h
|
||||||
${JMADIR}/inbyte.o: ${JMADIR}/inbyte.cpp
|
${JMADIR}/inbyte.o: ${JMADIR}/inbyte.cpp
|
||||||
${JMADIR}/jma.o: ${JMADIR}/jma.cpp ${JMADIR}/jma.h ${JMADIR}/crc32.h ${JMADIR}/portable.h ${JMADIR}/iiostrm.h
|
${JMADIR}/jma.o: ${JMADIR}/jma.cpp ${JMADIR}/jma.h ${JMADIR}/crc32.h ${JMADIR}/portable.h\
|
||||||
|
${JMADIR}/7z.h ${JMADIR}/iiostrm.h
|
||||||
${JMADIR}/lzma.o: ${JMADIR}/lzma.cpp
|
${JMADIR}/lzma.o: ${JMADIR}/lzma.cpp
|
||||||
${JMADIR}/lzmadec.o: ${JMADIR}/lzmadec.cpp
|
${JMADIR}/lzmadec.o: ${JMADIR}/lzmadec.cpp
|
||||||
${JMADIR}/winout.o: ${JMADIR}/winout.cpp ${JMADIR}/iiostrm.h
|
${JMADIR}/winout.o: ${JMADIR}/winout.cpp ${JMADIR}/iiostrm.h
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2004 NSRT Team ( http://nsrt.edgeemu.com )
|
Copyright (C) 2005 NSRT Team ( http://nsrt.edgeemu.com )
|
||||||
Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )
|
Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
@@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#ifndef __7Z_H
|
#ifndef __7Z_H
|
||||||
#define __7Z_H
|
#define __7Z_H
|
||||||
|
|
||||||
|
#include "iiostrm.h"
|
||||||
|
|
||||||
|
bool decompress_lzma_7z(ISequentialInStream& in, unsigned in_size, ISequentialOutStream& out, unsigned out_size) throw ();
|
||||||
bool decompress_lzma_7z(const unsigned char* in_data, unsigned in_size, unsigned char* out_data, unsigned out_size) throw ();
|
bool decompress_lzma_7z(const unsigned char* in_data, unsigned in_size, unsigned char* out_data, unsigned out_size) throw ();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
Copyright (C) 2005 NSRT Team ( http://nsrt.edgeemu.com )
|
||||||
Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )
|
Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
@@ -20,27 +21,31 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
#include "lzmadec.h"
|
#include "lzmadec.h"
|
||||||
|
|
||||||
bool decompress_lzma_7z(const unsigned char* in_data, unsigned in_size, unsigned char* out_data, unsigned out_size) throw () {
|
bool decompress_lzma_7z(ISequentialInStream& in, unsigned in_size, ISequentialOutStream& out, unsigned out_size) throw ()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
NCompress::NLZMA::CDecoder cc;
|
NCompress::NLZMA::CDecoder cc;
|
||||||
|
|
||||||
ISequentialInStream in(reinterpret_cast<const char*>(in_data), in_size);
|
|
||||||
ISequentialOutStream out(reinterpret_cast<char*>(out_data), out_size);
|
|
||||||
|
|
||||||
UINT64 in_size_l = in_size;
|
UINT64 in_size_l = in_size;
|
||||||
UINT64 out_size_l = out_size;
|
UINT64 out_size_l = out_size;
|
||||||
|
|
||||||
if (cc.ReadCoderProperties(&in) != S_OK)
|
if (cc.ReadCoderProperties(&in) != S_OK) { return(false); }
|
||||||
return false;
|
if (cc.Code(&in, &out, &in_size_l, &out_size_l) != S_OK) { return(false); }
|
||||||
|
if (out.size_get() != out_size || out.overflow_get()) { return(false); }
|
||||||
|
|
||||||
if (cc.Code(&in, &out, &in_size_l, &out_size_l) != S_OK)
|
return(true);
|
||||||
return false;
|
}
|
||||||
|
catch (...)
|
||||||
if (out.size_get() != out_size || out.overflow_get())
|
{
|
||||||
return false;
|
return(false);
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (...) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool decompress_lzma_7z(const unsigned char* in_data, unsigned int in_size, unsigned char* out_data, unsigned int out_size) throw ()
|
||||||
|
{
|
||||||
|
ISequentialInStream_Array in(reinterpret_cast<const char*>(in_data), in_size);
|
||||||
|
ISequentialOutStream_Array out(reinterpret_cast<char*>(out_data), out_size);
|
||||||
|
|
||||||
|
return(decompress_lzma_7z(in, in_size, out, out_size));
|
||||||
|
}
|
||||||
|
|||||||
@@ -327,11 +327,12 @@ ${EFFECTSDIR}/burn${OE}: $<
|
|||||||
${ZIPDIR}/unzip${OE}: $< ${ZIPDIR}/zunzip.h
|
${ZIPDIR}/unzip${OE}: $< ${ZIPDIR}/zunzip.h
|
||||||
${ZIPDIR}/zpng${OE}: $< ${ZIPDIR}/zpng.h
|
${ZIPDIR}/zpng${OE}: $< ${ZIPDIR}/zpng.h
|
||||||
|
|
||||||
${JMADIR}/7zlzma${OE}: $< ${JMADIR}/iiostrm.h
|
${JMADIR}/7zlzma${OE}: $< ${JMADIR}/7z.h ${JMADIR}/iiostrm.h
|
||||||
${JMADIR}/crc32${OE}: $< ${JMADIR}/crc32.h
|
${JMADIR}/crc32${OE}: $< ${JMADIR}/crc32.h
|
||||||
${JMADIR}/iiostrm${OE}: $< ${JMADIR}/iiostrm.h ${JMADIR}/crc32.h
|
${JMADIR}/iiostrm${OE}: $< ${JMADIR}/iiostrm.h ${JMADIR}/crc32.h
|
||||||
${JMADIR}/inbyte${OE}: $<
|
${JMADIR}/inbyte${OE}: $<
|
||||||
${JMADIR}/jma${OE}: $< ${JMADIR}/jma.h ${JMADIR}/crc32.h ${JMADIR}/portable.h ${JMADIR}/iiostrm.h
|
${JMADIR}/jma${OE}: $< ${JMADIR}/jma.h ${JMADIR}/crc32.h ${JMADIR}/portable.h\
|
||||||
|
${JMADIR}/7z.h ${JMADIR}/iiostrm.h
|
||||||
${JMADIR}/lzma${OE}: $<
|
${JMADIR}/lzma${OE}: $<
|
||||||
${JMADIR}/lzmadec${OE}: $<
|
${JMADIR}/lzmadec${OE}: $<
|
||||||
${JMADIR}/winout${OE}: $< ${JMADIR}/iiostrm.h
|
${JMADIR}/winout${OE}: $< ${JMADIR}/iiostrm.h
|
||||||
|
|||||||
Reference in New Issue
Block a user