Skip to content

Commit 4b073e1

Browse files
Fix ZIP Archive Loader and test examples 06 and 07
1 parent 58e19fc commit 4b073e1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples_tests/07.SubpassBaking/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class SubpassBaking : public ApplicationBase
146146
const auto swapchainImageUsage = static_cast<asset::IImage::E_USAGE_FLAGS>(asset::IImage::EUF_COLOR_ATTACHMENT_BIT);
147147
const video::ISurface::SFormat surfaceFormat(asset::EF_R8G8B8A8_SRGB, asset::ECP_SRGB, asset::EOTF_sRGB);
148148

149-
CommonAPI::InitWithDefaultExt(initOutput, video::EAT_OPENGL, "SubpassBaking", WIN_W, WIN_H, SC_IMG_COUNT, swapchainImageUsage, surfaceFormat, nbl::asset::EF_D32_SFLOAT);
149+
CommonAPI::InitWithDefaultExt(initOutput, video::EAT_VULKAN, "SubpassBaking", WIN_W, WIN_H, SC_IMG_COUNT, swapchainImageUsage, surfaceFormat, nbl::asset::EF_D32_SFLOAT);
150150
window = std::move(initOutput.window);
151151
apiConnection = std::move(initOutput.apiConnection);
152152
surface = std::move(initOutput.surface);

examples_tests/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ N = No support
3838
| 04.Keyframe | S | S | S | S | S | S | S | S | |
3939
| 05.NablaTutorialExample | Y | Y | Y | S | S | S | S | S | |
4040
| 06.MeshLoaders | Y | Y | Y | S | S | S | Y | Y | |
41-
| 07.SubpassBaking | S | S | S | S | S | S | S | S | |
41+
| 07.SubpassBaking | Y | Y | Y | S | S | S | S | S | |
4242
| FREE_SLOT | | | | | | | | | |
4343
| 09.ColorSpaceTest | W | W | W | W | W | W | W | W | |
4444
| 10.AllocatorTest | Y | Y | Y | S | S | S | N | N | |

src/nbl/system/CArchiveLoaderZip.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ core::smart_refctd_ptr<IFileArchive> CArchiveLoaderZip::createArchive_impl(core:
123123
item.pathRelativeToArchive = _path;
124124
item.size = meta.DataDescriptor.UncompressedSize;
125125
item.offset = offset;
126-
item.ID = items.size();
126+
item.ID = itemsMetadata.size();
127127
item.allocatorType = meta.CompressionMethod ? IFileArchive::EAT_VIRTUAL_ALLOC:IFileArchive::EAT_NULL;
128128
itemsMetadata.push_back(meta);
129129
};
@@ -232,7 +232,7 @@ core::smart_refctd_ptr<IFileArchive> CArchiveLoaderZip::createArchive_impl(core:
232232
SZIPFileHeader zipHeader;
233233
{
234234
IFile::success_t success;
235-
file->read(success,&zipHeader,0ull,sizeof(zipHeader));
235+
file->read(success,&zipHeader,offset,sizeof(zipHeader));
236236
if (!success)
237237
break;
238238
offset += success.getSizeToProcess();
@@ -393,7 +393,7 @@ CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFi
393393
CFileArchive::file_buffer_t retval = { nullptr,item->size,nullptr };
394394
//
395395
void* decrypted = nullptr;
396-
size_t decryptedSize = 0ull;
396+
size_t decryptedSize = header.DataDescriptor.CompressedSize;
397397
auto freeOnFail = core::makeRAIIExiter([&actualCompressionMethod,&retval,&decrypted,&decryptedSize](){
398398
if (decrypted && retval.buffer!=decrypted)
399399
{
@@ -424,7 +424,7 @@ CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFi
424424
const size_t reduction = saltSize+12u;
425425
if (header.DataDescriptor.CompressedSize<=reduction)
426426
return retval;
427-
decryptedSize = header.DataDescriptor.CompressedSize-reduction;
427+
decryptedSize -= reduction;
428428
}
429429
mmapPtr += saltSize;
430430
uint16_t& pwVerification = *reinterpret_cast<uint16_t*>(mmapPtr);

0 commit comments

Comments
 (0)