|
@@ -14,12 +14,12 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
-CZipStream::CZipStream(const boost::filesystem::path & archive, unz64_file_pos filepos)
|
|
|
+CZipStream::CZipStream(std::shared_ptr<CIOApi> api, const boost::filesystem::path & archive, unz64_file_pos filepos)
|
|
|
{
|
|
|
zlib_filefunc64_def zlibApi;
|
|
|
-
|
|
|
+
|
|
|
zlibApi = api->getApiStructure();
|
|
|
-
|
|
|
+
|
|
|
file = unzOpen2_64(archive.c_str(), &zlibApi);
|
|
|
unzGoToFilePos64(file, &filepos);
|
|
|
unzOpenCurrentFile(file);
|
|
@@ -53,7 +53,7 @@ ui32 CZipStream::calculateCRC32()
|
|
|
///CZipLoader
|
|
|
CZipLoader::CZipLoader(const std::string & mountPoint, const boost::filesystem::path & archive, std::shared_ptr<CIOApi> api):
|
|
|
ioApi(api),
|
|
|
- zlibApi(ioApi->getApiStructure()),
|
|
|
+ zlibApi(ioApi->getApiStructure()),
|
|
|
archiveName(archive),
|
|
|
mountPoint(mountPoint),
|
|
|
files(listFiles(mountPoint, archive))
|
|
@@ -66,7 +66,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
|
|
|
std::unordered_map<ResourceID, unz64_file_pos> ret;
|
|
|
|
|
|
unzFile file = unzOpen2_64(archive.c_str(), &zlibApi);
|
|
|
-
|
|
|
+
|
|
|
if(file == nullptr)
|
|
|
logGlobal->errorStream() << archive << " failed to open";
|
|
|
|
|
@@ -95,7 +95,7 @@ std::unordered_map<ResourceID, unz64_file_pos> CZipLoader::listFiles(const std::
|
|
|
|
|
|
std::unique_ptr<CInputStream> CZipLoader::load(const ResourceID & resourceName) const
|
|
|
{
|
|
|
- return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
|
|
|
+ return std::unique_ptr<CInputStream>(new CZipStream(ioApi, archiveName, files.at(resourceName)));
|
|
|
}
|
|
|
|
|
|
bool CZipLoader::existsResource(const ResourceID & resourceName) const
|