Difference between revisions of "SCAN (Metroid Prime)"

From Retro Modding Wiki
Jump to: navigation, search
(Thanks to Antidote for helping crack this format even further! I confirmed hex edits in Dolphin and found the red symbol flag.)
(Logbook Category)
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
The '''.SCAN file format''' describes scannable objects, and has references to several resources. It is a relatively simple format and has a static size.
+
''This article is for the SCAN format from Metroid Prime. For other revisions of this format, see [[SCAN (File Format)]].''
  
{{researchmajor|reason=Too many unknowns.}}
+
The '''SCAN file format''' describes scannable objects. It is a relatively simple format and has a static size.
  
 
__TOC__
 
__TOC__
  
== Header ==
+
== Format ==
 +
 
 +
The SCAN format is very simple; it has a header with data that contains general settings related to the scan, and then four structs defining how the scan images work. Even if a scan doesn't use four images, there are always four image structs, which means that the SCAN format has a static size; every SCAN file is 0x89 bytes (or 0xA0 bytes padded).
 +
 
 +
=== Header ===
  
 
The header is rather simple, and consists of the following:
 
The header is rather simple, and consists of the following:
Line 16: Line 20:
 
| 0x0
 
| 0x0
 
| 4
 
| 4
| '''Version'''
+
| '''Version'''; 3 for the demo, 5 for the final
 
|-
 
|-
 
| 0x4
 
| 0x4
Line 28: Line 32:
 
| 0xC
 
| 0xC
 
| 4
 
| 4
| '''[[STRG (File Format)|STRG]] ID'''
+
| '''Scan text [[STRG (File Format)|STRG]] ID'''
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 4
 
| 4
| {{unknown|'''Unknown'''; usually 0}}
+
| '''Scan Speed Flag'''; 0 = normal fast scan, 1 = slower scan (usually found in boss fights)
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 4
 
| 4
| '''Scan Type'''; 0 = No message, 1 = Pirate Data, 2 = Chozo Lore, 3 = Creatures, 4 = Research
+
| '''Logbook Category'''; see below
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 1
 
| 1
| '''Red Scan Symbol Flag'''; 0 = Orange symbol, 1 = Red symbol
+
| '''Scan Icon Flag'''; 0 = orange icon, 1 = red icon
 
|-
 
|-
 
| 0x19
 
| 0x19
Line 46: Line 50:
 
|}
 
|}
  
 +
==== Logbook Category ====
  
== Entry ==
+
There are six possible values:
  
Following the header is an array of 4 structs which follow this format:
+
{| class="wikitable"
 +
! ID
 +
! Category
 +
|-
 +
| 0
 +
| Not a logbook scan
 +
|-
 +
| 1
 +
| Space Pirate Data
 +
|-
 +
| 2
 +
| Chozo Lore
 +
|-
 +
| 3
 +
| Creatures
 +
|-
 +
| 4
 +
| Research
 +
|-
 +
| 5
 +
| Artifacts
 +
|}
 +
 
 +
=== Scan Images ===
 +
Following the header is an array of four structs that contain settings for up to four scan images. Although there can be anywhere from 0 to 4 scan images attached to a scan, there are always four scan image entries here. Entries that aren't used have their TXTR ID set to 0xFFFFFFFF, with the rest of the settings mostly left at defaults. They follow this format:
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Offset
 
! Offset
 
! Size
 
! Size
 +
! Type
 
! Description
 
! Description
 
|-
 
|-
 
| 0x0
 
| 0x0
 
| 4
 
| 4
 +
| long
 
| '''[[TXTR (Metroid Prime)|TXTR]] ID'''
 
| '''[[TXTR (Metroid Prime)|TXTR]] ID'''
 
|-
 
|-
 
| 0x4
 
| 0x4
 
| 4
 
| 4
| {{unknown|'''Unknown''' - float}}
+
| float
 +
| '''Appearance %'''; image will appear when the scan is this% complete. Should range from 0 to 1.
 
|-
 
|-
 
| 0x8
 
| 0x8
 
| 4
 
| 4
| {{unknown|'''Unknown''' - long}}
+
| long
 +
| '''Image Position'''; See below.
 
|-
 
|-
 
| 0xC
 
| 0xC
 
| 4
 
| 4
| {{unknown|'''Unknown''' - long}}
+
| long
 +
| '''Width'''; 0 = no animation
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| 4
 
| 4
| {{unknown|'''Unknown''' - long}}
+
| long
 +
| '''Height'''; 0 = no animation
 
|-
 
|-
 
| 0x14
 
| 0x14
 
| 4
 
| 4
| {{unknown|'''Unknown''' - long}}
+
| float
 +
| '''Interval'''; 0.0 = no animation
 
|-
 
|-
 
| 0x18
 
| 0x18
 
| 4
 
| 4
| {{unknown|'''Unknown''' - float}}
+
| float
 +
| '''Fade Duration'''; 0.0 = no fade
 
|-
 
|-
 
| 0x1C
 
| 0x1C
| colspan=2 {{unknown|End of entry}}
+
| colspan=3 {{unknown|End of entry}}
 
|}
 
|}
 +
 +
==== Image Position ====
 +
 +
There are 20 possible values for the scan image's position; there are ten for the left side, and ten for the right:
 +
{| class="wikitable"
 +
! Value
 +
! Size
 +
! Position
 +
! FRME_ScanHud Widget
 +
|-
 +
| 0x00
 +
| 1/4
 +
| Top-left corner
 +
| imagepane_pane0
 +
|-
 +
| 0x01
 +
| 1/4
 +
| Upper-middle-left
 +
| imagepane_pane1
 +
|-
 +
| 0x02
 +
| 1/4
 +
| Lower-middle-left
 +
| imagepane_pane2
 +
|-
 +
| 0x03
 +
| 1/4
 +
| Bottom-left corner
 +
| imagepane_pane3
 +
|-
 +
| 0x04
 +
| 1/2
 +
| Top-left corner
 +
| imagepane_pane01
 +
|-
 +
| 0x05
 +
| 1/2
 +
| Middle-left
 +
| imagepane_pane12
 +
|-
 +
| 0x06
 +
| 1/2
 +
| Bottom-left corner
 +
| imagepane_pane23
 +
|-
 +
| 0x07
 +
| 3/4
 +
| Top-left corner
 +
| imagepane_pane012
 +
|-
 +
| 0x08
 +
| 3/4
 +
| Bottom-left corner
 +
| imagepane_pane123
 +
|-
 +
| 0x09
 +
| 1
 +
| Left side
 +
| imagepane_pane0123
 +
|-
 +
| 0x0A
 +
| 1/4
 +
| Top-right corner
 +
| imagepane_pane4
 +
|-
 +
| 0x0B
 +
| 1/4
 +
| Upper-middle-right
 +
| imagepane_pane5
 +
|-
 +
| 0x0C
 +
| 1/4
 +
| Lower-middle-right
 +
| imagepane_pane6
 +
|-
 +
| 0x0D
 +
| 1/4
 +
| Bottom-right corner
 +
| imagepane_pane7
 +
|-
 +
| 0x0E
 +
| 1/2
 +
| Top-right corner
 +
| imagepane_pane45
 +
|-
 +
| 0x0F
 +
| 1/2
 +
| Middle-right
 +
| imagepane_pane56
 +
|-
 +
| 0x10
 +
| 1/2
 +
| Bottom-right corner
 +
| imagepane_pane67
 +
|-
 +
| 0x11
 +
| 3/4
 +
| Top-right corner
 +
| imagepane_pane456
 +
|-
 +
| 0x12
 +
| 3/4
 +
| Bottom-right corner
 +
| imagepane_pane567
 +
|-
 +
| 0x13
 +
| 1
 +
| Right side
 +
| imagepane_pane4567
 +
|-
 +
|}
 +
 +
<gallery mode=packed heights=200px>
 +
File:Scan_offsets_1.png|Image positions 0x00, 0x01, and 0x02
 +
File:Scan_offsets_3.png|Image positions for 0x04, 0x06, 0x0E, and 0x10
 +
File:Scan_offset_101.png|Image positions for 0x03, 0x05, and 0x0F. Note that 0x03 appears only for this scan (Omega Pirate's projectiles) and no others.
 +
File:Scan_offsets_10.png|Image positions for 0x09 and 0x13
 +
File:Scan_position_10000.png|This unused Chozo Elder scan (hacked onto Parasite Queen) shows image positions 0x0A and 0x0D. This scan is the only one where these positions are used.
 +
File:Scan_position_99.png|Image positions for 0x0B and 0x0C (unused)
 +
File:Scan_offset_11.png|Image positions for 0x07 and 0x11 (unused)
 +
File:Scan_offset_12.png|Image positions for 0x08 and 0x12 (unused)
 +
</gallery>
 +
 +
==== Fly In Behavior ====
 +
 +
The first scan image to appear (based on the appearance percent value) will "fly in" from the side of the screen toward the center. The remaining images will "fade in" without moving. The only exception to this is when the first image to appear is a "blank" image with no associated [[TXTR (Metroid Prime)|TXTR]]. In this case, no image will fly in (i.e., all images will fade in).
 +
 +
==== Scan Animations ====
 +
[[Image:AnimatedscanFinal.gif|thumb|The terminal with an animated scan image in the Map Facility.]]
 +
An extremely small number of scans display animated images in Metroid Prime. In the final version of the game, only a terminal in the Map Facility displays an animated image. In the demo version of the game, the aforementioned terminal scan and the Parasite Queen scan both display animated images. For most SCAN files, the last 32 bits of the scan image entry are zeroed out, but for the animated scans, these 32 bits have actual values in them. Strangely, the terminal directly to the left of the animated terminal in the Map Facility also has non-zero values for these 32 bits, even though it does not display any animated images.
 +
 +
 +
  
  
 
[[Category:File Formats]]
 
[[Category:File Formats]]
 
[[Category:Metroid Prime]]
 
[[Category:Metroid Prime]]

Latest revision as of 10:21, 13 January 2019

This article is for the SCAN format from Metroid Prime. For other revisions of this format, see SCAN (File Format).

The SCAN file format describes scannable objects. It is a relatively simple format and has a static size.

Format

The SCAN format is very simple; it has a header with data that contains general settings related to the scan, and then four structs defining how the scan images work. Even if a scan doesn't use four images, there are always four image structs, which means that the SCAN format has a static size; every SCAN file is 0x89 bytes (or 0xA0 bytes padded).

Header

The header is rather simple, and consists of the following:

Offset Size Description
0x0 4 Version; 3 for the demo, 5 for the final
0x4 4 Magic; always 0x0BADBEEF
0x8 4 FRME ID
0xC 4 Scan text STRG ID
0x10 4 Scan Speed Flag; 0 = normal fast scan, 1 = slower scan (usually found in boss fights)
0x14 4 Logbook Category; see below
0x18 1 Scan Icon Flag; 0 = orange icon, 1 = red icon
0x19 End of header

Logbook Category

There are six possible values:

ID Category
0 Not a logbook scan
1 Space Pirate Data
2 Chozo Lore
3 Creatures
4 Research
5 Artifacts

Scan Images

Following the header is an array of four structs that contain settings for up to four scan images. Although there can be anywhere from 0 to 4 scan images attached to a scan, there are always four scan image entries here. Entries that aren't used have their TXTR ID set to 0xFFFFFFFF, with the rest of the settings mostly left at defaults. They follow this format:

Offset Size Type Description
0x0 4 long TXTR ID
0x4 4 float Appearance %; image will appear when the scan is this% complete. Should range from 0 to 1.
0x8 4 long Image Position; See below.
0xC 4 long Width; 0 = no animation
0x10 4 long Height; 0 = no animation
0x14 4 float Interval; 0.0 = no animation
0x18 4 float Fade Duration; 0.0 = no fade
0x1C End of entry

Image Position

There are 20 possible values for the scan image's position; there are ten for the left side, and ten for the right:

Value Size Position FRME_ScanHud Widget
0x00 1/4 Top-left corner imagepane_pane0
0x01 1/4 Upper-middle-left imagepane_pane1
0x02 1/4 Lower-middle-left imagepane_pane2
0x03 1/4 Bottom-left corner imagepane_pane3
0x04 1/2 Top-left corner imagepane_pane01
0x05 1/2 Middle-left imagepane_pane12
0x06 1/2 Bottom-left corner imagepane_pane23
0x07 3/4 Top-left corner imagepane_pane012
0x08 3/4 Bottom-left corner imagepane_pane123
0x09 1 Left side imagepane_pane0123
0x0A 1/4 Top-right corner imagepane_pane4
0x0B 1/4 Upper-middle-right imagepane_pane5
0x0C 1/4 Lower-middle-right imagepane_pane6
0x0D 1/4 Bottom-right corner imagepane_pane7
0x0E 1/2 Top-right corner imagepane_pane45
0x0F 1/2 Middle-right imagepane_pane56
0x10 1/2 Bottom-right corner imagepane_pane67
0x11 3/4 Top-right corner imagepane_pane456
0x12 3/4 Bottom-right corner imagepane_pane567
0x13 1 Right side imagepane_pane4567

Fly In Behavior

The first scan image to appear (based on the appearance percent value) will "fly in" from the side of the screen toward the center. The remaining images will "fade in" without moving. The only exception to this is when the first image to appear is a "blank" image with no associated TXTR. In this case, no image will fly in (i.e., all images will fade in).

Scan Animations

The terminal with an animated scan image in the Map Facility.

An extremely small number of scans display animated images in Metroid Prime. In the final version of the game, only a terminal in the Map Facility displays an animated image. In the demo version of the game, the aforementioned terminal scan and the Parasite Queen scan both display animated images. For most SCAN files, the last 32 bits of the scan image entry are zeroed out, but for the animated scans, these 32 bits have actual values in them. Strangely, the terminal directly to the left of the animated terminal in the Map Facility also has non-zero values for these 32 bits, even though it does not display any animated images.