Invoking MW2

General Mech2 related Developments go here. Discussions welcome!

Moderator: Skyfaller

Forum rules
If you are writing a guide please do not post it here! Post in the Dev FAQ section please.
Post Reply
User avatar
Skyfaller
Clan 1st MechWarrior
Clan 1st MechWarrior
Posts: 1017
Joined: Sat Apr 12, 2008 2:58 am
Location: Germany
Contact:

Invoking MW2

Post by Skyfaller »

It has been reported in various places that MW2 missions can be started directly from the command line (1, 2, 3). These codes can be found by creating a fake MW2.exe file which prints or logs call parameters instead of or in addition to calling the actual MW2.exe. This still leaves some questions unanswered:
  • How does the shell tell the sim which mechs the user wishes to use? Userstar.bwd?
  • How does MW2 report the mission outcome back to the shell?
  • All Windows editions use DLL's rather than .exe's. Is it possible to create wrapper DLL's using Köntzä's project on Sourceforge?
MechWarrior 2
Here are the calling parameters for the Clan Jade Falcon missions:

[quote]C:\MECH2\MW2.EXE pinkSCN1 -b=ljfvant -of=echelonl
C:\MECH2\MW2.EXE greeSCN1 -b=ljfsude -of=echelonl
C:\MECH2\MW2.EXE red_SCN1 -b=ljfzoet -of=echelonl
C:\MECH2\MW2.EXE fuchSCN1 -b=ljfsude -of=echelonl
C:\MECH2\MW2.EXE cindSCN1 -b=ljftria -of=echelonl
C:\MECH2\MW2.EXE rustSCN1 -b=ljfmacd -of=echelonl
C:\MECH2\MW2.EXE umbeSCN1 -b=ljfevci -of=echelonl
C:\MECH2\MW2.EXE tan_SCN1 -b=ljftwyc -of=echelonl
C:\MECH2\MW2.EXE heidSCN1 -b=ljftria -of=echelonl
C:\MECH2\MW2.EXE plumSCN1 -b=ljfwota -of=echelonl
C:\MECH2\MW2.EXE whitSCN1 -b=ljfwota -of=echelonl
C:\MECH2\MW2.EXE jillSCN1 -b=ljftria -of=echelonl
C:\MECH2\MW2.EXE puceSCN1 -b=ljfmorg -of=echelonl
C:\MECH2\MW2.EXE blonSCN1 -b=ljfmorg -of=echelonl
C:\MECH2\MW2.EXE bronSCN1 -b=ljfmorg -of=echelonl
C:\MECH2\MW2.EXE marySCN1 -b=ljftria -of=echelonl
[/quote]

The *scn1 are the scenario BWD's, -b defines the .SHP launch screen (LAUNCH subdirectory), and -of gives the formation type for the user's star.

Calling parameters for Clan Wolf missions:

[quote]C:\MECH2\MW2.EXE yellSCN1 -b=lwocolm -of=echelonl
C:\MECH2\MW2.EXE oranSCN1 -b=lwosude -of=echelonl
C:\MECH2\MW2.EXE tealSCN1 -b=lwozoet -of=echelonl
C:\MECH2\MW2.EXE taupSCN1 -b=lwobake -of=echelonl
C:\MECH2\MW2.EXE jennSCN1 -b=lwotria -of=echelonl
C:\MECH2\MW2.EXE sablSCN1 -b=lwomacd -of=echelonl
C:\MECH2\MW2.EXE greySCN1 -b=lwoevci -of=echelonl
C:\MECH2\MW2.EXE browSCN1 -b=lwotwyc -of=echelonl
C:\MECH2\MW2.EXE amy_SCN1 -b=xxxxxxxx.xxx -of=echelonl
C:\MECH2\MW2.EXE silvSCN1 -b=lwowota -of=echelonl
C:\MECH2\MW2.EXE aquaSCN1 -b=lwowota -of=echelonl
C:\MECH2\MW2.EXE kim_SCN1 -b=lwotria -of=echelonl
C:\MECH2\MW2.EXE cyanSCN1 -b=lwomorg -of=echelonl
C:\MECH2\MW2.EXE maroSCN1 -b=lwomorg -of=echelonl
C:\MECH2\MW2.EXE goldSCN1 -b=lwomorg -of=echelonl
C:\MECH2\MW2.EXE irenSCN1 -b=lwotria -of=echelonl[/quote]
GBL regular missions
[quote]mw2.exe bassSCN1 -b=bass -of=echelonl
mw2.exe jessSCN1 -b=jess -of=echelonl
mw2.exe claiSCN1 -b=clai -of=echelonl
mw2.exe newcSCN1 -b=newcstl -of=echelonl
mw2.exe jeehSCN1 -b=jeeh -of=echelonl
mw2.exe tim_SCN1 -b=tim -of=echelonl
mw2.exe tim_SCN1 -b=tim -of=echelonl
mw2.exe andySCN1 -b=andy -of=echelonl
mw2.exe fostSCN1 -b=fost -of=echelonl
mw2.exe hoffSCN1 -b=hoff -of=echelonl
mw2.exe zackSCN1 -b=zack -of=echelonl
mw2.exe seanSCN1 -b=sean -of=echelonl
mw2.exe franSCN1 -b=fran -of=echelonl
mw2.exe asahSCN1 -b=asahi -of=echelonl
mw2.exe peteSCN1 -b=pete -of=echelonl
mw2.exe cathSCN1 -b=cath -of=echelonl
mw2.exe sachSCN1 -b=sach -of=echelonl
mw2.exe branSCN1 -b=bran -of=echelonl
[/quote]

Bloodname special missions:
[quote]mw2.exe gui1SCN1 -b=guin1 -of=echelonl
mw2.exe gui2SCN1 -b=guin2 -of=echelonl
mw2.exe gui3SCN1 -b=guin3 -of=echelonl
mw2.exe gui4SCN1 -b=guin4 -of=echelonl
mw2.exe guinSCN1 -b=guin5 -of=echelonl
[/quote]
Visual Studio contains a nice tool for obtaining info on DLL's: dumpbin. Here's what it says about exports from mw2.dll:
1 0 0000CC70 SimMain
2 1 0000D95D SimWindowProc
It says pretty much the same for all Windows versions of MW2.DLL respectively MercsW.DLL. SimMain should be the entry point for the sim, and the event handler SimWindowProc is also exported. This raises the question of whether to call SimMain or to create a window that uses SimWindowProc. The names are not decorated, meaning that they don't give any clues about their calling parameters. Too bad.

Userstar.bwd defines the user's star/lance when launching into combat. It contains a GPS tag for each mech on the lance/star. See this thread for details on the GPS tag.

(Cleaned Up Thread by Sir MMPD Radick, with later edits by Skyfaller)
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: Invoking MW2

Post by Col.Kell »

  • The name for the BWD file defining the mech, at offset 25h rel. to GPS,
  • The name of the mech config, either as a reference into MW2.PRJ or the MEK subdirectory, at offset 2Dh rel. to GPS
  • The pilot's name at offset 36h,
  • Some number at 8.
That mystery number at 8h is probably the one that defines the mechwarrior's rank, at least one of them does. I played the first GBL mission as a Galaxy Commander!
MechWarrior 2: 31stCC
Image
Post Reply