Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating empty archive results in file_size and data_start being zero in SARC header #10

Open
davidzchen opened this issue May 31, 2024 · 0 comments

Comments

@davidzchen
Copy link

davidzchen commented May 31, 2024

Steps to reproduce:

  1. Create an empty directory
  2. Run SARC-Tool on the empty directory to create an empty archive.
  3. Inspect header

I wrote a tool (in a private repository) that dumps the headers and other metadata for a SARC archive, and here is what I got when running on an empty archive:

$ bazel build //tools:sarc-dump
$ bazel-bin/tools/sarc-dump oepd/sarc/testdata/empty-little-endian.sarc
SARC Archive: oepd/sarc/testdata/empty-little-endian.sarc

Endian: Little Endian

== SARC Header
magic:           53415243
header_size:     14
byte_order_mark: feff
file_size:       0
data_start:      0
version:         100
reserved:        0

== SFAT Header
magic:       53464154
header_size: c
nodes_count: 0
hash_key:    65

== SFNT Header
magic:       53464e54
header_size: 8
reserved:    0

-- File Names:

Is this a bug? IIUC, file_size should be the size of the entire archive, while data_start should be the offset from the beginning of the archive to where the file data starts (rather than the offset after the headers).

The zeldamodees/oead implementation seems to confirm this: https://github.com/zeldamods/oead/blob/b31e5bc96bab9ee7e84971c8f2ca34073d0263af/src/sarc.cpp#L331-L341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant