MAC Format - KCreator/Earth-Defence-Force-Documentation GitHub Wiki

The results are based on a survey conducted in 4.1, so they may not apply to 5. This is a rough survey and may contain errors. If there are any errors, please keep correcting them. The data size is an estimate based on [the total data length / the number of data]. Unless otherwise noted, all offsets are relative to the beginning of the table entry.

Overview

The MAC file is divided into blocks with the following headers.

Header Description
MARC Unknown
SGO(tree or wire) Settings related to trees or wire? Some maps don't have. Can be analyzed by SGOTT.
MTAB Unknown. Some maps don't have.
MAPB Relates to the coordinates of the map object.
SGO(Contains the string "Scenetype") Scenetype = 0 is the normal map, 1 is the underground map (cannot request air support, bike appear immediately). Can be analyzed by SGOTT.
SGO(Contains the string "Action_00_LOD_Level_00") Settings for the parameters of each map object. Can be analyzed by SGOTT.
SGO(Contains the string "Brightness") Settings for the light and color of the map. It exists for every weather. Can be analyzed by SGOTT. (example1) "FarClipZ" is set to a large value, the description distance can be increased.(example2) "FogEnd" is set to a large value, the fog disappears.
SGO(Contains the string "Grass10SizeMax") Settings for Grass ? Can be analyzed by SGOTT.
.PMR Settings for "navigationmap", "grass", "electrical wire","move_limit(map boundaries)". Can be analyzed by SGOTT or S's Tool.
MAPO Settings for the offset of each part of the map object and the color of the light emission.

Header "MARC": 36 (0x24) bytes

Offset Size Description
0x00 4 Always 'MARC'
0x04 4 Always 05 00 00 00
0x08 4 Offset to data start position = header size
0x0C 4 Unknown(Same value as 0x10, related to file size)
0x10 4 Unknown(Same value as 0x0C, related to file size)
0x14 4 Offset to MARC's table entry (offset from this position).
0x18 4 Count of elements in the table. 24 bytes per count.
0x1C 4 Offset to string table contains "elec_wire_default.erb"
0x20 4 Count of elements in the table. 2 bytes per count.

MARC's table: 24 (0x18) bytes

This table is located at the bottom of the MAC file.

Offset Size Description
0x00 4 Offset to a string indicating the block name. have extensions such as (.sgo)(.mta)(.trb)(.erb)(.mapb)(.mapo)(.rmpa)
0x04 4 block address(absolute)
0x08 4 block size
0x0C 4 Unknown(Same value for each data ?)
0x10 4 Unknown(Each data is close to each other ?)
0x14 4 Always zero ?

Header "MAPB": 144 (0x90) bytes

The table numbers are defined in the order of appearance in the header. Note that it is not the order of appearance in the file.

Offset Size Description
0x00 4 Always 'MAPB'
0x04 4 Always 02 00 00 00
0x08 4 Offset to a string table containing "elec_wire_default" immediately after the "Brightness" string table.
0x0C 4 Count of elements in the table. 2 bytes per count.
0x10 4 Always zero ?
0x14 4 Always zero ?
0x18 4 Offset to MAPB's 1st table entry
0x1C 4 Count of elements in the table. 56 bytes per count.
0x20 4 Offset to MAPB's 2nd table entry
0x24 4 Count of elements in the table. 68 bytes per count.
0x28 4 Offset to SGO that contains the string "Brightness" and "fine" weather (offset from this position).
0x2C 4 Always zero ?
0x20 4 Offset to SGO that contains the string "Brightness" and "sunset" weather (from this position).
0x34 4 Always zero ?
0x38 4 Offset to SGO that contains the string "Brightness" and "cloudy" weather (offset from this position).
0x3C 4 Always zero ?
0x40 4 Offset to SGO that contains the string "Brightness" and "evening" weather (offset from this position).
0x44 4 Always zero ?
0x48 4 Offset to SGO that contains the string "Brightness" and "finecloud" weather (offset from this position).
0x4C 4 Always zero ?
0x50 4 Offset to SGO that contains the string "Brightness" and "cloudy2" weather (offset from this position).
0x54 4 Always zero ?
0x58 4 Offset to SGO that contains the string "Brightness" and "night" weather (offset from this position).
0x5C 4 Always zero ?
0x60 4 Always zero ?
0x64 4 Always zero ?
0x68 4 Always zero ?
0x6C 4 Always zero ?
0x70 4 Offset to SGO that contains the string "Grass10SizeMax" (offset from this position).
0x74 4 Always zero ?
0x78 4 Offset to MAPB's 3rd table entry
0x7C 4 Offset to MAPB's 4th table entry
0x80 4 Always zero ?
0x84 4 Always zero ?
0x88 4 Offset to SGO that contains the string "Scenetype" (offset from this position).
0x8C 4 Always zero ?

MAPB's 1st table: 56 (0x38) bytes

Offset Size Description
0x00 4 Unknown int ?
0x04 4 Offset to SGO that contains the string "Action_00_LOD_Level_00" (offset from this position).
0x08 4 Always zero ?
0x0C 4 Offset to string contains (.mdx) or (.mosb) or (.trb) (offset from this position).
0x10 4 Unknown (always FF FF FF FF ?)
0x14 4 Unknown Offset(zero in most cases)
0x18 4 Unknown float value(maybe related to LOD?)
0x1C 4 Unknown float value(maybe related to LOD?)
0x20 4 Unknown Offset(zero in most cases)
0x24 4 Unknown (always 00 00 80 BF ?)
0x28 4 Unknown Offset(zero in most cases)
0x2C 4 Unknown (always 00 00 80 BF ?)
0x30 4 Always zero ?
0x34 4 Always zero ?

MAPB's 2nd table: 68 (0x44) bytes

Relates to the coordinates of the map object.

Offset Size Description
0x00 4 Offset to MAPB's 1st table data
0x04 4 Position X
0x08 4 Position Y
0x0C 4 Position Z
0x10 4 Rotation X
0x14 4 Rotation Y
0x18 4 Rotation Z
0x1C 4 Always zero ?
0x20 4 Always zero ?
0x24 4 Always zero ?
0x28 4 Always zero ?
0x2C 4 Unknown OffsetSeen with objects that have another object on top (e.g. a train station building with a car in NW_KITAGUNICITY.MAC)
0x30 4 Always zero ?
0x34 4 Unknown value
0x38 4 Unknown value
0x3C 4 Unknown value
0x40 4 Unknown value

MAPB's 3rd table: 16 (0x10) bytes

Offset Size Description
0x00 4 Offset to 3rd-1 table entry
0x04 4 Count of elements in the table. 12 bytes per count.
0x08 4 Offset to 3rd-2 table entry
0x0C 4 Count of elements in the table. 12 bytes per count.

MAPB's 3rd-1 table: 12 (0x0C) bytes

The first 12 bytes appear not to be a float (header?). It matches the 12 bytes from the front of each data in the MAPB 4th-1 table.

Offset Size Description
0x00 4 Unknown float
0x04 4 Unknown float
0x08 4 Unknown float

MAPB's 3rd-2 table: 12 (0x0C) bytes

Offset Size Description
0x00 4 Offset to a string containing, for example, "ig_grassdense2small","ig_dryleaf01"
0x04 4 Offset to 3rd-2 sub table
0x08 4 Count of elements in the table. 8 bytes per count.

MAPB's 3rd-2 sub table: 8 (0x08) bytes

Offset Size Description
0x00 2 Unknown
0x02 2 Unknown
0x04 2 Unknown
0x06 2 Unknown

MAPB's 4th table: 24 (0x18) bytes

Offset Size Description
0x00 4 Offset to 4th-1 table entry
0x04 4 Count of elements in the table. 16 bytes per count.
0x08 4 Unknown
0x0C 4 Unknown
0x10 4 Offset to 4th-2 table entry
0x14 4 Count of elements in the table. 4 bytes per count.

MAPB's 4th-1 table: 16 (0x10) bytes

The first 16 bytes do not appear to be a float (header?). When the last 4 bytes of each data are removed, they match each data in MAPB 3rd-1 table.

Offset Size Description
0x00 4 Unknown float
0x04 4 Unknown float
0x08 4 Unknown float
0x0C 4 Always zero ?

MAPB's 4th-2 table: 4 (0x04) bytes

Offset Size Description
0x00 4 Offset to a string containing, for example, "elec_wire_default"

Header "MAPO": 88 (0x58) bytes

The table numbers are defined in the order of appearance in the header. Note that it is not the order of appearance in the file.

Offset Size Description
0x00 4 Always 'MAPO'
0x04 4 Always zero ?
0x08 4 Offset to MAPO's 1st table entry
0x0C 4 Count of elements in the table. 28 bytes per count.
0x10 4 Offset to MAPO's 2nd table entry
0x14 4 Count of elements in the table. 12 bytes per count.
0x18 4 Always zero ?
0x1C 4 Always zero ?
0x20 4 Offset to MAPO's 3rd table entry
0x24 4 Count of elements in the table. 56 bytes per count.
0x28 4 Offset to MAPO's 4th table entry
0x2C 4 Count of elements in the table. 4 bytes per count.
0x30 4 Offset to MAPO's 5th table entry
0x34 4 Count of elements in the table. 12 bytes per count.
0x38 4 Offset to MAPO's 6th table entry
0x3C 4 Count of elements in the table. 16 bytes per count.
0x40 4 Offset to MAPO's 7th table entry
0x44 4 Count of elements in the table. 16 bytes per count.
0x48 4 Offset to string table contains (.mdb) or (.hkt)
0x4C 4 Count of elements in the table. 2 bytes per count.
0x50 4 Always zero ?
0x54 4 Always zero ?

MAPO's 1st table: 28 (0x1C) bytes

In MAPO's 1st table data, data that does not follow the rules, such as 3F800000 at the beginning, may appear, but I am not sure about this, so I ignore it.

Offset Size Description
0x00 4 Basically zero, but may have an offset.
0x04 4 Offset to MAPO's 4th table data (Then jump from 4ht table to 3rd table)
0x08 4 Unknown int ?
0x0C 4 Unknown float
0x10 4 Offset to string contains (.mdb)
0x14 4 Offset to string contains (.hkt)
0x18 4 Offset to MAPO's 2nd table data

MAPO's 2nd table: 12 (0x0C) bytes

Offset Size Description
0x00 4 Offset to MAPO's 4th table data (Then jump from 4ht table to 3rd table)
0x04 4 Unknown int ?
0x08 4 Unknown float

MAPO's 3rd table: 60 (0x3C) bytes

Offset Size Description
0x00 4 Unknown (0 to 4 ?)
0x04 4 Offset to string contains (.hkt)
0x08 4 Offset to MAPO's 6th table data
0x0C 4 Offset to MAPO's 7th table data
0x10 4 Offset to MAPO's 5th table data
0x14 4 Offset to string contains (.mdb) or (_hk.mdb)
0x18 4 Offset to string contains (_hk.hkt)
0x1C 4 Unknown float
0x20 4 Offset to string contains (.mdb)
0x24 4 Unknown float
0x28 4 Offset to string contains (_lod.mdb)
0x2C 4 Always zero ?
0x30 4 Unknown Offset
0x34 4 Always zero ?
0x38 4 Unknown Offset

MAPO's 4th table: 4 (0x04) bytes

offset table. MAPO's 1st table or 2nd table will link to here, and then jump to 3rd table.

Offset Size Description
0x00 4 Offset to MAPO's 3rd table data

MAPO's 5th table: 12 (0x0C) bytes

It is located immediately after the MAPO's header. The relative position of each component from the base position of the map object ?

Offset Size Description
0x00 4 Relative position of map object components (X)
0x04 4 Relative position of map object components (Y)
0x08 4 Relative position of map object components (Z)

MAPO's 6th table: 16 (0x10) bytes

Related to deformation and expansion of map objects ?

Offset Size Description
0x00 4 X-axis deformation (Rotation ?)
0x04 4 Y-axis deformation (Rotation ?)
0x08 4 Z-axis deformation (Rotation ?)
0x0C 4 scale ?

MAPO's 7th table: 16 (0x10) bytes

Offset Size Description
0x00 4 Emission color of the map object (R)
0x04 4 Emission color of the map object (G)
0x08 4 Emission color of the map object (B)
0x0C 4 Emission color of the map object (A) ?

Adding or Deleting Map Objects

The tool is currently being created and includes hypotheticals. The number of pieces of data in "MAPB 2nd" and "MAPO 1st" appears to be the same. This means that the X'th data in "MAPB 2nd" and the X'th data in "MAPO 1st" are a set, and they must be added or deleted at the same time. (In some cases, adding only "MAPB 2nd" may not cause a crash, but it can slip through without making contact, or it may crash if destroyed by explosives.) After adding or deleting the sets, each offset is shifted by the addition or deletion. Then, in theory, you should be able to add or delete map objects.