mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 06:32:32 +01:00
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.
39 lines
723 B
C++
39 lines
723 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 = "*") {
|
|
uint size = stream.size();
|
|
auto data = new uint8[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
|