Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/nall/stream/zip.hpp
2 views
1
#ifdef NALL_STREAM_INTERNAL_HPP
2
3
namespace nall {
4
5
struct zipstream : memorystream {
6
inline zipstream(const stream &stream, const string &filter = "*") {
7
unsigned size = stream.size();
8
uint8_t *data = new uint8_t[size];
9
stream.read(data, size);
10
11
zip archive;
12
if(archive.open(data, size) == false) return;
13
delete[] data;
14
15
for(auto &file : archive.file) {
16
if(file.name.wildcard(filter)) {
17
archive.extract(file, pdata, psize);
18
return;
19
}
20
}
21
}
22
23
inline ~zipstream() {
24
if(pdata) delete[] pdata;
25
}
26
};
27
28
}
29
30
#endif
31
32