DESTINY 1

The build

Every fact in these pages is about one build: the PS4 executable of Destiny 1, version 1.29. Other builds are used for names and cross-checks only.

PS4 version 1.29

propertyvalue
titleCUSA00219, the US release
version1.29
dateSeptember 2016
module nametiger_release_final
executable size29.1 MB
executable SHA-2567271fcb926401df8defb126cb8eb2b247134138b81e401bbacb2ab60791b7954
compilerSony’s clang toolchain, release build
obfuscationnone: no packing and no control-flow flattening
class namesfull Itanium RTTI, with 1,380 Bungie c_ and s_ type names

The executable is plain. Unlike the Destiny 2 PC build, nothing is encrypted and every string can be read from the file.

The three modules

The game ships its own C library and file library. They load next to the executable and bind to it directly.

executablelibc.prxlibSceFios2.prx
functions55,0802,028650
symbols7872,171248
imports used by relocations6557481
exports522,095165
TLS image size8,1761,16864
  • The executable’s imports come from 43 libraries.
  • 182 imports bind between the three modules. The rest go to the system.
  • The executable’s code ends with a PLT of 639 entries. Read-only data follows in the same executable segment.
  • Every function larger than a leaf stub has unwind data: 54,065 entries, none overlapping.
  • C++ exceptions are used in only 33 functions of the executable, with 144 landing pads. libc.prx has 225 exception tables.
  • No code reads its own return address, and the only thread-local access pattern is mov rax, fs:[0], 2,542 times.

Third-party libraries

Most of the image is engine code. These libraries are linked in:

libraryrole
Havok 2012.2.0physics
Wwiseaudio
CRI Movie 3.50 (Sofdec2)video
Demonware, version 45online services
NP ToolkitPSN services
Oodlecompression
libGnm, libGnmx, GpuAddressSony’s graphics libraries, linked statically
libtommathbig-number math
Umbraassumed: one string only

These libraries make most of the game’s system calls themselves. See The platform layer.

Video

Movies are CRI USM files: CRI MPV 2.100 video with ADX and HCA audio, decoded in software. The game imports no Sony video decoder. All 16 movies in the packages are USM.

Bink is dead code. A function still builds the paths bink\%s_%d.bik for attract_1 to attract_3, intro, credits and story, but it passes them to an empty function.

What the build does not have

absentnote
a save data librarycharacters live on the server
a keyboard or mouse librarypads only; see The platform layer
a video decoder, microphone input, JPEG or PNGnone of these libraries is imported
libSceFiberthe job system runs on plain threads

Packages

All game data is in 1,647 package files. The game holds no media outside them. A package is a header, an entry table and a block table. Each table is checked against a SHA-1 in the header.

header offsetfield
+0x0016-bit value 24
+0x0416-bit package id
+0x0616-bit block mode; 0 means each entry is one plain read
+0x2016-bit patch number
+0x2216-bit language: 0 none, 1 English, 2 to 7 the others
+0xB4, +0xB8, +0xBCentry count, entry table offset, its SHA-1
+0xD0, +0xD4, +0xD8block count, block table offset, its SHA-1
+0xEC, +0xF0, +0xF4symbol count, offset, SHA-1; 68-byte rows
+0x13Cfile size
struct entry {            /* 16 bytes */
    uint32_t tag;         /* data tag, schema class id, or 0xFFFFFFFF for most GPU data */
    uint16_t flags;
    uint8_t  heap;
    uint8_t  type;
    uint64_t location;    /* bits 0-13 block; 14-27 offset in the block, 16-byte units; 28-57 size */
};

struct block {            /* 32 bytes */
    uint32_t file_offset;
    uint32_t stored_size;
    uint16_t patch;       /* the patch file that holds the bytes */
    uint16_t flags;       /* bit 0: Oodle-compressed */
    uint8_t  sha1[20];    /* of the stored bytes */
};
  • A block decodes to at most 0x40000 bytes. An entry can run on into the next blocks.
  • A tag is 0x80000000 | (package_id + 0x400) << 13 | entry_index. The pool decode is in Rendering: Handles.
  • Only three shared manifest packages use block mode 0. Their blocks are stored plain and lie back to back, so a plain read gives the same bytes as a block read.
  • The entry flags pick the load handler, in this order: 0x4 high mip, 0x300 movie, 0x100 Havok, 0x200 sound, 0x90 schema, 0x1 GPU data, 0x60 GPU header.

All package files together hold:

kindcount
textures57,741
shader headers37,451, with 26,402 distinct programs
movies16, all USM, 4,413 MiB

The newest package files hold 159,964 .wem sounds, all Vorbis, and 48,399 soundbanks with no sound inside.

How block hashes are checked on load is in The platform layer: Package block hashes.

The Xbox One build

The Xbox One executable is used to cross-check the PS4 build. It is never a base.

propertyvalue
filetiger_release_final.exe
build56578
date12 April 2017, about 6.5 months after PS4 version 1.29
SDKXbox One XDK, November 2015
compilerMSVC
  • It has no Bungie class names. Its 495 RTTI names all belong to Havok, Demonware, CRI and WinRT. The PS4 build stays the source of class names.
  • It shares 5,155 log and format strings with the PS4 build. 3,708 of them are used by exactly one Xbox function, so they pair functions across the two builds.
  • Its .schmr section holds the tag schema table. 5,871 schema ids are the same as in the PS4 build.
  • 15 built-in shaders carry their HLSL source. The PS4 build has 29 built-in shader blocks, tagged OrbShdr. They are assumed to be the same set.
  • Its render backend runs on D3D11.X and pairs with the PS4 one almost function for function. See Rendering.

Destiny 2

Destiny 1 and Destiny 2 share the Tiger engine. Destiny 2’s PS4 build from 2020 keeps the same time control and render layer. The Destiny 2 PC build keeps the same time control, render layer and platform layer. Many struct offsets are the same. What carries over to Destiny 2 build 86657 and what does not is in The build: Differences from Destiny 1.

Not checked

  • What the symbol table rows of a package hold.
  • How much of Umbra the build uses.
  • Whether the 29 OrbShdr blocks match the Xbox build’s 15 HLSL shaders.