diff --git a/Crafter.Asset-Asset.cpp b/Crafter.Asset-Asset.cpp index d93badf..7cae7df 100644 --- a/Crafter.Asset-Asset.cpp +++ b/Crafter.Asset-Asset.cpp @@ -62,7 +62,7 @@ AssetLoad::AssetLoad(fs::path path) : f(path, std::ios::binary) { entries[i].offset = header.offset; headerLength+=header.nameLenght + header.typeLenght; } - headerLength = sizeof(std::uint32_t)*2 + (sizeof(std::uint32_t)*4*entryCount); + headerLength += sizeof(std::uint32_t)*2 + (sizeof(std::uint32_t)*4*entryCount); } std::vector AssetLoad::Load(std::string_view name) { @@ -117,18 +117,18 @@ void AssetLoad::Load(const AssetEntry& entry, void* data, uint32_t lenght) { } std::vector AssetLoad::LoadOffset(uint32_t offset, uint32_t lenght) { - f.seekg(offset+headerLength); + f.seekg(offset+headerLength, std::ios_base::beg); std::vector vector(lenght); f.read(vector.data(), lenght); return vector; } void AssetLoad::LoadOffset(uint32_t offset, uint32_t lenght, void* data) { - f.seekg(offset+headerLength); + f.seekg(offset+headerLength, std::ios_base::beg); f.read(reinterpret_cast(data), lenght); } std::vector AssetLoad::LoadAll() { - f.seekg(headerLength); + f.seekg(headerLength, std::ios_base::beg); return std::vector((std::istreambuf_iterator(f)), std::istreambuf_iterator()); }