Add object spec

This commit is contained in:
Arthur Beck 2025-03-18 17:08:43 -05:00
parent 2cbdb63646
commit 1bfa1d5e4e
No known key found for this signature in database
GPG key ID: ACE3D14F5CEF14BF

43
OBJECTS.md Normal file
View file

@ -0,0 +1,43 @@
# Object format
Objects are stored for each mod. Each object consists of a custom binary diff-style format(where numbers are little-endian unless otherwise noted):
```
0x0B7D1FF0: Magic number
0x00000000: 32-bit version. By convention, unofficial object formats should have the left-most(commonly referred to as the 31st bit) set.
0x0000000000000007: 64-bit number of entries
0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000: Padding
0xCF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E: SHA512 hash of object with hash replaced with this hash(the SHA512 hash of an empty string)
(entries)
```
Each entry is in the format:
```
0x0000000000000007: 64-bit size of path in bytes
0x0000000000000008: Number of diffs
0x00: Type of change: 0=Removal of file(no diffs), 1=Modification or addition
(path as a UTF-8 encoded string using UNIX conventions such as a forward slash / as a separator)
(diffs)
```
Each diff is in the format:
```
0x00: Type of change: 0=Removal(no body), 1=Insertion, 2=Replacement
0x00000000000000: Padding
0x0000000000000000: Start of change (relative to original file)
0x0000000000000010: Length of change
(body)
```
Known versions:
|32-bit value|Name|
|-----|-----|
|0x00000000|Official venus version 0.1(this doc)|