Patching MechCommander's "left arm bug" for fun and profit

Narann1 pts0 comments

Patching MechCommander’s "left arm bug" for fun and profit – MHLoppy

--><br>--><br>--><br>-->

-->

-->

--><br>--><br>--><br>--><br>-->

Skip to content

MechCommander 1 has an annoying quirk where it shoves all1 of a mech’s biggest weapons into its left arm. If your mech is kitted out with mostly/only big weapons, then losing that arm means you basically lose the mech.

Normally this issue doesn’t have much impact on the outcome of a mission. Specifically targeting individual locations on a mech has pretty low accuracy (even with high-gunnery pilots) so it tends to not matter much for enemy mechs, and the chance that one of your own mechs loses specifically that arm by pure chance is pretty low — though it can happen. It’s still a weird issue though, and the times where it does happen to you can be a little rough.

Well no more! After being infected by Vana with a brain worm about why the code for distributing components didn’t seem to work for big weapons, I spent a day figuring it out and now have a working fix.

(Note that I’m going to be referring to the location in question as the "left arm" even though it’s not clear whether it’s actually the "left arm" or the "right arm" and the visuals of the mech are inconsistent after losing an arm. This is the location that gets blown off when you use the "fire at left arm" command as labeled in the manual, so I’m going with that.)

About a month ago I noted that MechCommander 1 (or at least the MechCommander Gold copy that I have) seems to come with embedded debugging symbols of some kind, giving some useful limited insight into what the game’s code is actually doing.2

This means that we can take a gander to find out:

Which weapons count as "big" (is it just the >=9 tons rule I’ve seen tossed around?)

How weapons and equipment are distributed on a mech

Why the hell "big" weapons specifically all get lumped into the left arm

Sir, this Long Tom looks real big from down here — I think we can call it "big"

The game exe itself is in machine code (or if first disassembled, assembly). But thanks to tools like Ghidra (yes, by the wonderful folks at the NSA) we can also translate individual functions into C-like code. This translation won’t necessarily be accurate to the structure of the original source code, but it generally has much better at-a-glance readability than the assembly does.

To start off with, here’s the function that seems to determine whether a weapon is "big" "large", which is the classification that’s relevant to the left arm bug.

G:\mcx\logistics.cpp: ? */<br>if (((((param_1 G:\mcx\logistics.cpp: ? */<br>if (((((param_1<br>When combined with the weapon IDs in the compbas.csv file (which is packed inside the MISC.FST file)3 and other sources (including some testing of my own), we can translate this into a list of "large" and "small" weapons, where "small" is just everything that isn’t explicitly defined as "large".

IDWeaponAvailabilityTonnageSize98Rail GunExpansion only30.0Small99Light Gauss RifleExpansion only13.5Small100Light AutocannonBase game9.5Large101AutocannonBase game15.5Large102Heavy AutocannonBase game19.5Large103Light Ultra AutocannonBase game11.0Large104Gauss RifleBase game16.5Large107Light LB-X AutocannonExpansion only9.5Small108LB-X AutocannonExpansion only14.5Small109Heavy LB-X AutocannonExpansion only19.5Small110C. Light Ultra AutocannonBase game8.5Large111C. Ultra AutocannonBase game13.5Large112C. Heavy Ultra AutocannonBase game17.5Large113C. Gauss RifleBase game13.5Large116C. Light LB-X AutocannonExpansion only8.5Small117C. LB-X AutocannonExpansion only13.5Small118C. Heavy LB-X AutocannonExpansion only17.5Small120LRM RackBase game4.0Small123SRM PackBase game3.0Small125Streak SRM PackBase game5.0Small126Heavy ThunderboltExpansion only21.0Small130C. LRM RackBase game3.0Small133C. SRM PackBase game3.0Small135C. Streak SRM PackBase game4.75Small139Large X-Pulse LaserExpansion only13Small140Laser LaserBase game9.5Small141Large ER LaserBase game11.0Large142Large Pulse LaserBase game12.0Large143LaserBase game4.0Small144Pulse LaserBase game6.0Small145PPCBase game12.0Large146ER PPCBase game15.5Large147Heavy FlamerBase game8.0Small150C. Large ER LaserBase game10.0Large151C. Large Pulse LaserBase game11.0Large152C. ER LaserBase game3.5Small153C. Pulse LaserBase game4.0Small154C. ER PPCBase game13.5Large155C. Heavy FlamerBase game7.0Small160Long Tom CannonExpansion only34.0Small<br>(I’ve excluded several invalid weapons from the list, including a few weapons explicitly checked in the getWeaponLarge() function like the LRM 15 that I assume are just cut content and that — as far as I know — you never actually encounter in-game. The Sniper Cannon which you only get from cheating is also treated as inaccessible content for the purpose of this article)

So the first and most obvious takeaway is that LRMs come in racks but SRMs come in packs, which is vital information for defeating the Clan invaders. Can you imagine if somebody called them LRM packs or SRM racks? You...

weapons left laserbase mech autocannonbase autocannonexpansion

Related Articles