mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
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 ...
39 lines
722 B
C++
Executable File
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
|