bsnes/nall/stream/zip.hpp
Tim Allen 483fc81356 Update to v094r44 release.
byuu says:

Changelog:
- return open bus instead of mirroring addresses on the bus (fixes
  Mario&Luigi, Minish Cap, etc) [Jonas Quinn]
- add boolean flag to load requests for slotted game carts (fixes slot
  load prompts)
- rename BS-X Town cart from psram to ram
- icarus: add support for game database

Note: I didn't rename "bsx" to "mcc" in the database for icarus before
uploading that. But I just fixed it locally, so it'll be in the next
WIP. For now, make it create the manifest for you and then rename it
yourself. I did fix the PSRAM size to 256kbit.
2015-10-01 20:00:28 +10:00

39 lines
733 B
C++

#ifndef NALL_STREAM_ZIP_HPP
#define NALL_STREAM_ZIP_HPP
#include <nall/decode/zip.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);
Decode::ZIP archive;
if(archive.open(data, size) == false) return;
delete[] data;
for(auto& file : archive.file) {
if(file.name.match(filter)) {
auto buffer = archive.extract(file);
psize = buffer.size();
pdata = buffer.release();
return;
}
}
}
~zipstream() {
if(pdata) delete[] pdata;
}
};
}
#endif