JFIF Backgrounds

From CloudModding OoT Wiki
Jump to: navigation, search

All information by Underscore, Peardian

How JPG Renders Work

OoT uses the JPEG File Interchange Format (JFIF), a format that stopped being updated as of 1992. This format has a more in-depth document available at W3C (1992), however that document does not apply as strictly to the Legend of Zelda, so dwelling on it is not recommended.

JPG Renders are used in rooms in Ocarina of Time that do not tend to move, such as shops and the back alleys. These rooms have collision data that is separate from the pre-rendered image. This is done so that the game can conserve space by having a constant illusory camera angle, without having to render a given number of models that have to be textured, wasting the dynamic camera angle and system memory resources.

The JPG Renders are stored in various locations throughout the ROM and are listed below.

Format

The JPG Render format is as follows.

Name Data Purpose
Begn FF D8 The marker to identify that the image started.
(Included in the actual image itself.
APP0 FF E0 A marker to identify that header has started.
Leng 00 10 The length of the header excluding the APP0 marker and all other markers. 0x0010 = 16 in dec. All images use a header length of 16.
Iden 4A 46 49 46 00 The JFIF identifier, followed by a null byte.
Vers 01 01 Version, first being major, second being the minor.
LoZ:OoT used version 1.01.
Dens 00 Density units.
00 No units, aspect ratio only specified.
01 Pixels per inch.
02 Pixels per centimeter.
Xden 00 01 Integer horizontal pixel density. (1)
Yden 00 01 Integer vertical pixel density. (1)
Twid 00 Embedded thumbnail width. (0)
Thig 00 Embedded thumbnail height. (0)
Tdat n/a Because thumbnails were not used or needed, and the length is not included in the header above, it is not needed. But, for the sake of completion, the length of this section would be Twid*Thig*3 (0)
Mark FF DB This serves to note the end of the header and is not included in its length.
Data ... This is the actual data for the image, but it is useless unless the header is also included with it.
End FF D9 The marker to identify that the image has finished. (Included in the actual image itself.)

(All data in hex, all data required for extraction.)

List of JPG Renders

This section lists all positions of JPG renders and their aliases.

Position Name
0x027B06F0 Depth Test
0x02B64480 Kokiri Link's House
0x02B96490 Kokiri Shop
0x02BC3430 Kokiri Know-It-All-Brothers' House
0x02C4E370 Market Entrance Day
0x02CA3FB0 Bazaar
0x02D09120 Market Back Alley 1 Day
0x02D2E920 Market Back Alley 2 Day
0x02D54120 Market Back Alley 3 Day
0x02D9E370 Market Entrance Night
0x02DC5360 Market Entrance Future
0x02DED110 Market Back Alley 1 Night
0x02E12910 Market Back Alley 2 Night
0x02E38110 Market Back Alley 3 Night
0x02E6C0C0 Kokiri Twins' House
0x02EAAA50 Lon Lon Ranch Stable
0x02ED77C0 Kakariko House
0x02F1DDA0 Kakariko Gravekeepr's Hut
0x02F809D0 Goron Shop
0x02FA89E0 Zora Shop
0x02FD6660 Kakariko Potion Shop
0x02FFE430 Market Potion Shop
0x03028160 Market Bombchu Shop
0x030507A0 Market Mamamu Yan's House
0x0307DEF0 Kakariko Anju's House
0x030B2EA0 Valley Tent
0x031C80F0 Kokiri Mido's House
0x032030E0 Kokiri Saria's House
0x03259D80 Market Pink Pants House
0x032E6AF0 Temple of Time Day
0x0330C2F0 Temple of Time Path Day
0x03355B10 Temple of Time Night
0x0337B310 Temple of Time Path Night
0x033AAAF0 Temple of Time Future
0x033D02F0 Temple of Time Path Future
0x03554E40 Market Happy Mask Shop

Usage in Zelda 64

JFIF images are pointed to from within the map's mesh header, when header type 1 is used.