home pictures webcam about me various eu2
inferis.org

eu2 » Magellan

 
Magellan is the first result of years of hacking the EU2 tbl files.
It is a set of tools to alter the EU2 map image.

You can also check out the thread on the EU2 forums on how this came to be.

Available tools
Magellan is a set of 5 tools, namely:
  • mextract - Extract Map data from the game
  • minject - Inject (modified) Map data into the game
  • mimage - Import and export map image data from the intermediate format
  • mprovince - Import and export province data from the intermediate format
  • mcolor - Convert colour values to IDs and vice versa
  • mstats - Generate stats
  • mview - View eu2map files
The current version is: 1.0 (final).
If you need help on a tool, use can use the /? option to get the help descriptions as shown below.

You can download Magellan 1.0 below.

mextract
You use this tool to extract map data from the game itself into an intermediate format (.eu2map).
Usage:
MEXTRACT <destination[.eu2map]> [/D:directory] [/C] [/O] [/1|/2|/3]

  <destination>   Specifies the file to export to. The extension is automatically added if it is omitted.
  /O              Allows overwriting an existing file when extracting.
  /D:<dir>        Specifies the base directory to look for the files. This should be the root EU2 directory.
  /1              Indicates to only extract lightmap1.
  /2              Indicates to only extract lightmap1 and lightmap2.
  /3              Indicates to extract all lightmaps.
  /G              Forces ID tbl to be generated from lightmap1, even if the program thinks it shouldn't be.
  /C              Create an empty eu2map file (no actual extraction is done).

The extractor will lookup the EU2 path through the registry.
By default, the extractor will extract all 3 lightmaps.

This extraction process can take a while, as it generates it's own copy of id.tbl, but it only does this when the EU2 version is the original version.
Newer versions of id.tbl are extracted as is.

Keep in mind that extracting is merely copying the EU2 file versions into the intermediate format. This means that if those are modded already, you'll be extracting the modded version!

This tool does not yet support Moddir... It probably will in the future.

minject
You use this tool to inject map data from the intermediate format (.eu2map) into the game itself.
Usage:
MINJECT <source[.eu2map]> [/D:<directory>] [/L]

  <destination>   Specifies the file to export to. The extension is automatically added if it is omitted.
  /D:<dir>        Specifies the base directory to put the result files. This should be the root EU2 directory.
  /L              Indicates to regenerate lightmap2 and lightmap3 from lightmap1 (downsizing).
  /S              Indicates to save the source file after injecting the data (including all generated info).
  /NOTOT          Don't include the ToT and HRE fields in province.csv. Use this for compatibility with older EU2 versions.

The injector will lookup the EU2 path through the registry.

The injection process generates several files needed by the engine. This includes boundbox.tbl, idgrid.tbl, incgrid.tbl. This can take a while.
This will overwrite the existing EU2 files. It is adviced to backup the complete Map directory, and Db/Province.csv. After all, this is still beta software.

This tool does not yet support Moddir... It probably will in the future.
The /L option is currently unimplemented.

mimage
You use this tool import, export and query portions of the map. Usage:
MIMAGE /I <source[.psd]> <destination[.eu2map]> [/1|/2|/3] [/G:<level>] [/P] [/PEDANTIC]
MIMAGE /SI <source[.psd]> <destination[.eu2map]> [/1|/2|/3] [/G:<level>] [/P] [/PEDANTIC]
MIMAGE /C <source[.psd]> [/P] [/PEDANTIC]
MIMAGE /E <source[.eu2map]> [<destination[.psd]>] [/R:<x,y,width,height>] [/1|/2|/3] [/O] [/P]
MIMAGE /Q <source[.psd]> <destination[.eu2map]>

  /I              Indicates that you're importing an image into a map file.
  /E              Indicates that you're exporting an image from a map file.
  /Q              Indicates that you're querying an image file.
  /SI             Indicates that you're simulating an import. This is identical to /I, but
                  the target file will not be modified, even if something goes wrong.
  /C              Indicates that you're checking a source image. This checks if the psd is correctly
                  formatted, and if the idmap contains correct values.
  <source>        Specifies the source file. This should be a PSD file for the /I and /Q actions,
                  and a EU2MAP file for the /E action.
  <destination>   Specifies the destination file. This should be a EU2MAP file for the /I action,
                  and a PSD file for the /E action.
                  If you omit the destination while exporting, one will be generated for you.
  /1              Uses lightmap1 as source/target (depending on the action).
  /2              Uses lightmap2 as source/target (depending on the action).
  /3              Uses lightmap3 as source/target (depending on the action).
  /R:<region>     Specifies the region to be exported. x,y denotes the topleft corner of the rectangle,
                  width,height are the width and height of the rectangle. This will be adjusted by the program
                  to the nearest 32x32 boundaries.
  /O              Allows overwriting an existing file when exporting.
  /P              Exports 3 PNG files instead of 1 PSD file. The PSD extension is automatically
                  changed into PNG, and each file is appended with the layer name which would normally
                  appear in the PSD file. The MapInfo layer is omitted.
  /G:<level>      This option indicates how to generate adjacent.tbl when importing.
                  0 -> No regenerating is done.
                  1 -> Indicates to do a quick regenerate. This only happens when the ID map was modified. (default)
                  2 -> Indicates to do a quick regenerate, even if the ID map wasn't modified.
                  3 -> Indicates to do a complete regenerate. (Long!)
  /PEDANTIC       Uses pedantic ID matching when importing an image. In this mode, the colour values must be exact.
  /CHECKIDGRID    Checks the complexity of the ID grid regions of the imported area.
                  Works only in simulation mode. (This feature is EXPERIMENTAL!)

Not specifying a /G:x option defaults to /G:1 being used.
If no lightmap is specified, lightmap1 is used by default.

The exported files are PSD files with 4 layers. The MapInfo layer should not be modified, as it contains vital info for importing.
You can modify the three other layers at will.

mprovince
You use this tool to import or export the province data from the intermediate format (.eu2map).
Usage:
MPROVINCE /I <source[.csv|.xml]> <destination[.eu2map]> [/XML|/CSV]
MPROVINCE /E <source[.eu2map]> [<destination[.csv|.xml]>] [/O] [/XML|/CSV]

  /I              Indicates that you're importing an image into a map file.
  /E              Indicates that you're exporting an image from a map file.
  <source>        Specifies the source file. This should be a PSD file for the /I and /Q actions,
                  and a EU2MAP file for the /E action.
  <destination>   Specifies the destination file. This should be a EU2MAP file for the /I action,
                  and a PSD file for the /E action.
                  If you omit the destination while exporting, one will be generated for you.
  /O              Allows overwriting an existing file when exporting.
  /XML            Specifies that the province file should be in XML format (regardless of import/export).
  /CSV            Specifies that the province file should be in CSV format (regardless of import/export).

If you omit the /XML or /CSV option, the program will choose XML by default when exporting. When importing,
it will to figure out the file format itself.

If you changed provinces (for example: land zone --> sea zone) then it is important to first import the modified province.csv file into the .eu2map file, before you import the modified map image.
The province data is important when compressing the map, so it needs to be up to date.

The XML option only supports exporting for the moment.

mstats
Exports statistics (or something) from an EU2Map file.
Usage:
MSTATS /BB  <source[.eu2map]> [<destination[.csv|.xml]>] [/O] [/XML|/CSV]
MSTATS /ADJ <source[.eu2map]> [<destination[.csv|.xml]>] [/O] [/XML|/CSV]
MSTATS /R   <source[.eu2map]> [<destination[.csv|.xml]>] [/O] [/XML|/CSV]

  /BB             Indicates that you want to export Boundbox info from the file.
  /ADJ            Indicates that you want to export Adjacency info from the file.
  /R              Indicates that you want to export Region info from the file.
  <source>        Specifies the source file (a EU2MAP file).
  <destination>   Specifies the destination file.
                  If you omit the destination while exporting, one will be generated for you.
  /O              Allows overwriting an existing file when exporting.
  /XML            Specifies that exported data should be in XML format.
  /CSV            Specifies that exported data should be in CSV format.

If you omit the /XML or /CSV option, the program will choose CSV by default.

mcolor
Finally, the mcolor tool is used to convert Province IDs to RGB values, and the other way around.
Usage:
MCOLOR [/RGB:<colour|red,green,blue>] [/ID:<id>] [/C:<name>]

  /RGB:<colour>   Specifies a colour value to be converted to an ID, encoded as a 4byte integer value,
                  using RGB order (blue in the lowest 8bits, green in the next 8 bits and red in the top 8 bits.
                  The upper 8 bits are unused and will not be considered when converting.
  /RGB:<r,g,b>    Specifies a colour value to be convert to and ID. Each colour component is expressed seperately,
                  separated by commas. Each value should be expressed in hexadecimal format, ranging from 00 to FF.
  /ID:<id>        Specifies the ID to convert. This should be in the range 0 to 1615.
  /C:<name>       Specifies what IDConvertor to use. If omitted, it will use "Inferis2".
                  If you specify a "?" as the name, the program will show a list of possible convertor names.

Starting the program without parameters will show a GUI where you can do multiple conversions.

If you specify no parameters, you'll get a GUI tool:

It's up to you to use the command line /RGB or /ID.
The default ID convertor used is Inferis2, but you'll see there are other supported.

Download

Marianas (Release Candidate 1)

(current: 2.4.0-rc1) - EXPERIMENTAL
magellan.2.4.0-Marianas-rc1-2020.zip - For EU2 v1.09 (2020 provinces)
Changelog

Sulawesi

(current: 2.2.1)
magellan.2.2.1-Sulawesi-2020.zip - For EU2 v1.09 (2020 provinces)
Changelog

Celebes

(2.2.0)
magellan.2.2-Celebes-2020.zip - For EU2 v1.09 (2020 provinces)
Changelog

Elcana

(2.1.0, no longer supported)
magellan.2.0-Elcana-2020.zip - For EU2 v1.09 (2020 provinces)
Changelog

Virgenes

(2.0.0, no longer supported)
magellan.2.0-Virgenes-2020.zip - For EU2 v1.09 (2020 provinces)
Changelog

Warning! You'll need the .Net Framework 2.0 runtime for this to work.

Older versions
Older versions, no longer supported. These are build against the 1.1 runtime.

1.1

(1.1.0, downloadable, but no longer supported)
magellan.1.1.0-2020.zip - For EU2 v1.09 (2020 provinces)

1.0

(1.0.3, no longer supported)
magellan.1.0.3-2020.zip - For EU2 v1.09 (2020 provinces)
There is no version for 1615 provinces of this release. If enough people require it, I'll make one (maybe).

Release Candidate 1

(no longer supported)
magellan.0.99.11.rc1-2020.zip - Supporting apr12 beta and later (2020 provinces)
magellan.0.99.11.rc1-1615.zip - Supporting apr12 beta and later (1615 provinces)
beta 2 to rc1 Changelog

Beta 2

(no longer supported)
magellan.0.99.10.beta2-2020.zip - Supporting feb2 beta and later (2020 provinces)
magellan.0.99.10.beta2-1615.zip - Supporting earlier than feb2 beta (1615 provinces)
beta 1 to beta 2 Changelog

Beta 1

(no longer supported)
magellan.0.99.8.beta1-2020.zip - Supporting feb2 beta and later (2020 provinces)
magellan.0.99.8.beta1-1615.zip - Supporting earlier than feb2 beta (1615 provinces)

Thanks
I'd like to thank:
  • Johan from Paradox for providing necessary parts of source code to put me on the right track
  • Hive for keep pushing me to finish this.
  • WiSK for his own effort, which stimulated me on finishing my own
  • Kasperus for providing excellent bugreports and testfiles
  • Jaron for moral support ;)
And the rest too, of course...