MEK files - Mech configs

Binary formats and related hacking.

Moderator: Skyfaller

Post Reply
User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

MEK files - Mech configs

Post by Skyfaller » Sun Nov 15, 2009 4:18 pm

Here are my notes on the MW2 MEK file format used to store Mech configs. I'll update them as needed.

General Information:
00h - DWORD - Tonnage
04h - DWORD - Walking Movement Points
08h - DWORD - JumpJet Count
0Ch - DWORD - Heatsink Count
10h - DWORD - Number of Weapons
14h - DWORD - Ammo Count

After general information, the mech sections are described.
Each section has the following layout:
00h - DWORD - Front Armor
04h - DWORD - Rear Armor
08h - DWORD - Internal Structure
0Ch - WORD[12] - Criticals
24h - Word - #Criticals in this section
26h - Word - 1

The sections are stored at these offsets:
018h - Head, 6 criticals
040h - Right Torso, 12 criticals
068h - Center Torso, 12 criticals
090h - Left Torso, 12 criticals
0B8h - Right Arm, 12 criticals
0E0h - Left Arm, 12 criticals
108h - Left Leg, 6 criticals
130h - Right Leg, 6 criticals

If the same weapon is present several times, each recurrence has a +1 incremented code.

After the section table follows the weapons group table. It consists of 8-byte-records. Their number is stored in offset 10h, with the following layout:
0h - WORD - Weapon ID
05 - Byte - Weapon Group

Neither MW2's mech lab nor the sim allow more than ten weapons to be mounted on a mech. 31stcc-DOS and GBL-DOS ignore weapon groups.

Ammo section:
8 bytes for each weapon with ammo:
0h - DWORD - Ammo ID
4h - DWORD - associated weapon

The MEK file is concluded by 50 characters that comment the file.

The codes in MW2:31st Century Combat are different from those in MW2:Mercs and the Titanium Editions. If there are more heat sinks than round down (engine rating/25), but no heat sinks in the critical hits table, then the heat sinks are double heat sinks. All ammo for a weapon has the numeric code of the weapon plus 10000. The following 6 bytes can be used as a signature: 0C 17 44 16 76 16, starting at offset 24h. MW2.prj contains MEK files in the MEK folder.
MW2 Weapon IDs for 31stcc, GBL (DOS, Win95)
0 LRM 20
100 LRM 15
200 LRM 10
300 LRM 5
400 SRM 6
500 SRM 4
600 SRM 2
700 Streak SRM 6
800 Streak SRM 4
900 Streak SRM 2

1000 MG
1100 Gauss Rifle
1200 LB-X Autocannon/2
1300 LB-X Autocannon/5
1400 LB-X Autocannon/10
1500 LB-X Autocannon/20
1600 Ultra Autocannon/2
1700 Ultra Autocannon/5
1800 Ultra Autocannon/10
1900 Ultra Autocannon/20

2000 Flamer
2100 ER PPC
2200 ER Large Laser
2300 ER Medium Laser
2400 ER Small Laser
2500 Large Pulse Laser
2600 Medium Pulse Laser
2700 Small Pulse Laser
2800 NARC
2900 Anti-Missile System

3000 Nuke
3100 SRM2 Inferno
3200 SRT 4
3300 Streak SRM2 Inferno
3400 Arrow IV

5000 MASC
5300 Shoulder
5350 Upper Arm Actuator
5400 Lower Arm Actuator
5450 Hand
5500 Hip
5550 Upper Leg Actuator
5600 Lower Leg Actuator
5650 Foot
5700 Sensors
5750 Cockpit
5800 Gyroscope
5850 Engine
5900 Life Support

6000 Heat Sinks, may be single or double
7000 Jump Jet
8000 Endo Steel
9000 Ferro-Fibrous
10000+X Ammo (X)
MW2 Weapon IDs in MEK files since Mercs
0 LRM 20 (Clan)
100 LRM 15 (Clan)
200 LRM 10 (Clan)
300 LRM 5 (Clan)
400 SRM 6 (Clan)
500 SRM 4 (Clan)
600 SRM 2 (Clan)
700 Streak SRM 6 (Clan)
800 Streak SRM 4 (Clan)
900 Streak SRM 2 (Clan)

1000 MG (Clan)
1100 Gauss Rifle (Clan)
1200 LB-X Autocannon/2 (Clan)
1300 LB-X Autocannon/5 (Clan)
1400 LB-X Autocannon/10 (Clan)
1500 LB-X Autocannon/20 (Clan)
1600 Ultra Autocannon/2 (Clan)
1700 Ultra Autocannon/5 (Clan)
1800 Ultra Autocannon/10 (Clan)
1900 Ultra Autocannon/20 (Clan)

2000 Flamer (Clan)
2100 ER PPC (Clan)
2200 ER Large Laser (Clan)
2300 ER Medium Laser (Clan)
2400 ER Small Laser (Clan)
2500 Large Pulse Laser (Clan)
2600 Medium Pulse Laser (Clan)
2700 Small Pulse Laser (Clan)
2800 NARC (Clan)
2900 Anti-Missile System (Clan)

3000 Nuke (Clan)
3200 SRT 4 (Clan)
3400 Arrow IV (Clan)
3500 LRM 20
3600 LRM 15
3700 LRM 10
3800 LRM 5
3900 SRM 6
4000 SRM 4
4100 SRM 2
4200 Streak SRM 2

4300 Machine Gun
4400 Gauss
4500 Autocannon/2
4600 Autocannon/5
4700 Autocannon/10
4800 Autocannon/20
4900 Ultra Autocannon/5
5000 LB-X Autocannon/10

5100 Flamer
5200 ER PPC
5300 PPC
5400 ER Large Laser
5500 Large Laser
5600 Medium Laser
5700 Small Laser
5800 Large Pulse Laser
5900 Medium Pulse Laser

6000 Small Pulse Laser
6100 NARC
6200 Anti-Missile System

7000 MASC (Clan)
7300 Shoulder
7350 Upper Arm Actuator
7400 Lower Arm Actuator
7450 Hand
7500 Hip
7550 Upper Leg Actuator
7600 Lower Leg Actuator
7650 Foot
7700 Sensors
7750 Cockpit
7800 Gyro
7850 Engine
7900 Life Support

8000 Heat Sink
8500 Jump Jet

9000 Endo Steel Internals
9500 Ferro-Fibrous Armor
9550 CASE

10000+X Ammo (X)
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: MEK files - Mech configs

Post by Col.Kell » Tue Dec 08, 2009 8:50 am

Nice work, Sky! I've wondered about this.
I remember trying to hex edit mek files and getting a mech that weighed 250,000 tons...
MechWarrior 2: 31stCC
Image

User avatar
Skyfaller
Clan 2nd MechWarrior
Clan 2nd MechWarrior
Posts: 991
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Re: MEK files - Mech configs

Post by Skyfaller » Tue Dec 08, 2009 11:11 am

Thanks. It sure is fun to run around in a Daishi at 200kph...
Download MechVM

If you have problems with MechVM, please attach the files MechVM.cfg and install-report.txt from the folder where MechVM installed your game.

User avatar
Col.Kell
House Steiner Archon
House Steiner Archon
Posts: 868
Joined: Sat Sep 27, 2008 7:44 am
Location: An Isolated Tennessee Valley.

Re: MEK files - Mech configs

Post by Col.Kell » Wed Dec 09, 2009 9:02 am

Skyfaller wrote:Thanks. It sure is fun to run around in a Daishi at 200kph...
haha! Better yet its fun to shoot off in a Firemoth at +100,000kmph and dissappear from the map :lol: have you used that old MechEdit program before? Its fun to just mess with it.

I also found long ago that strange things would happen when I played a Mercs MEK file in 31stCC.
MechWarrior 2: 31stCC
Image

Post Reply