Tim Allen 75dab443b4 Update to v092r08 release.
byuu says:

Changelog:
- fixed cartridge load window focus on Windows
- lots of updates to nall, ruby and phoenix
- ethos and Emulator::Interface updated from "foo &bar" to "foo& bar"
  syntax (work-in-progress)

Before I had mixed the two ways to declare variables/arguments all over
the place, so the goal is to unify them all for consistency. So the
changelog for this release will be massive (750KB >.>) due to the syntax
change. Yeah, that's what I spent the last three days working on ...
2013-05-02 21:25:45 +10:00

39 lines
722 B
C++
Executable File

#ifndef NALL_STREAM_ZIP_HPP
#define NALL_STREAM_ZIP_HPP
#include <nall/unzip.hpp>
namespace nall {
struct zipstream : memorystream {
using stream::read;
using stream::write;
zipstream(const stream& stream, const string& filter = "*") {
unsigned size = stream.size();
uint8_t* data = new uint8_t[size];
stream.read(data, size);
unzip archive;
if(archive.open(data, size) == false) return;
delete[] data;
for(auto& file : archive.file) {
if(file.name.wildcard(filter)) {
auto buffer = archive.extract(file);
psize = buffer.size();
pdata = buffer.move();
return;
}
}
}
~zipstream() {
if(pdata) delete[] pdata;
}
};
}
#endif