bsnes/nall/stream/gzip.hpp
Tim Allen f2a416aea9 Update to v095r11 release.
byuu says:

Changelog:
- SFC: "uint8 read(uint addr)" -> "uint8 read(uint addr, uint8 data)"
- hiro: mHorizontalLayout::setGeometry() return value
- hiro/GTK: ListView,TreeView::setFocused() does not grab focus of first
  item

Notes:
- nall/windows/utf8.hpp needs using uint = unsigned; at the top to
  compile
- sfc/balanced, sfc/performance won't compile yet

Seems Cx4 games broke a while back. Not from this WIP, either. I'll go
back and find out what's wrong now.
2015-12-14 20:41:06 +11:00

35 lines
611 B
C++

#ifndef NALL_STREAM_GZIP_HPP
#define NALL_STREAM_GZIP_HPP
#include <nall/decode/gzip.hpp>
namespace nall {
struct gzipstream : memorystream {
using stream::read;
using stream::write;
gzipstream(const stream& stream) {
uint size = stream.size();
auto data = new uint8[size];
stream.read(data, size);
Decode::GZIP archive;
bool result = archive.decompress(data, size);
delete[] data;
if(!result) return;
psize = archive.size;
pdata = new uint8_t[psize];
memcpy(pdata, archive.data, psize);
}
~gzipstream() {
if(pdata) delete[] pdata;
}
};
}
#endif