Update how offset is calculated
This commit is contained in:
parent
7e08071e45
commit
c0d9858b97
@ -77,8 +77,6 @@ bool create_asset_pack(const char *dirpath, const char *output) {
|
|||||||
if (result.fp) {
|
if (result.fp) {
|
||||||
++(pak.toc.count);
|
++(pak.toc.count);
|
||||||
|
|
||||||
offset += sizeof(pak_entry_t);
|
|
||||||
|
|
||||||
toc_entry_t *toc_entry = create_toc_entry(result.name, offset);
|
toc_entry_t *toc_entry = create_toc_entry(result.name, offset);
|
||||||
pak_entry_t *pak_entry = create_pak_entry_from_file(result.fp);
|
pak_entry_t *pak_entry = create_pak_entry_from_file(result.fp);
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ bool create_asset_pack(const char *dirpath, const char *output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pak.toc.size += sizeof(toc_entry_t) + toc_entry->length;
|
pak.toc.size += sizeof(toc_entry_t) + toc_entry->length;
|
||||||
offset += pak_entry->size;
|
offset += sizeof(pak_entry_t) + pak_entry->size;
|
||||||
|
|
||||||
darr_add(&toc_entries_darr, (void *)toc_entry);
|
darr_add(&toc_entries_darr, (void *)toc_entry);
|
||||||
darr_add(&pak_entries_darr, (void *)pak_entry);
|
darr_add(&pak_entries_darr, (void *)pak_entry);
|
||||||
|
@ -124,8 +124,7 @@ i32 main(i32 argc, char *argv[]) {
|
|||||||
|
|
||||||
pos = ftell(fp);
|
pos = ftell(fp);
|
||||||
|
|
||||||
u64 new_pos =
|
u64 new_pos = toc_entries[i]->offset + sizeof(pak_t) + pack.toc.size;
|
||||||
toc_entries[i]->offset + sizeof(pak_t) + pack.toc.size - sizeof(u64);
|
|
||||||
|
|
||||||
fseek(fp, new_pos, SEEK_SET);
|
fseek(fp, new_pos, SEEK_SET);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user