[Windows Mobile Development and Hacking General] sztupy:
mode9converter

Mode9 converter​

This tool will convert Manila mode9 files to/from XML and YAML formats.

It's purpose is to provide an alternative way for mode9 editing. But the concept of exporting a mode9 file to XML, edit it, and then reconverting it to mode9 file is considered more dangerous than simply edit the parts of the file you need to and leave the rest intact. Because of this I would mainly recommend 6Fg8's mode9 editor for these tasks.

Usage

Converting to XML or YAML formats from binary mode9

mode9converter -tx file.mode9 > file.xml

mode9converter -ty file.mode9 > file.yaml

Editing files

You can edit the outputted XML and/or YAML files with any editor you prefer, but you should keep the ordering of the attributes intact (for example first comes the Name attribute, then the X, Y, Z, etc.)

Converting from XML or YAML formats to binary mode9

mode9converter -bx file.mode9 file.xml

mode9converter -by file.mode9 file.yaml

Configuration

mode9converter uses the mode9_tags.yaml file to determine the binary representations of the tags, attributes and types. It has 3 categories:

1. tags:

You can set which tag name belongs to which ID. You can also set a "nexttype" attribute here, which will set the type of the next 0x0e4a4722 (untyped) attribute

2. attributes:

You can set which ID correspods to which attribute name and which type. You can also set an attribute as a "type setter", which will set the type of the next correspoing 0x0e4a4722 attribute

3. types

you can set which name corresponds to which type. Mode9converter uses the following types:

String: UTF-16LE encoded strings (represented as UTF-8 in XML and YAML)

Path: UTF-16LE encoded strings (represented as UTF-8 in XML and YAML)

UInt32: 4 byte unsigned integer

Q16: 4 byte Q16.16 fixed point number

Int32: 4 byte signed integer

Boolean: 4 byte, either 1 or 0

Vector3: 3*4 bytes of Q16 numbers (X,Y,Z)

RectQ16: 4*4 bytes Q16 numbers (X,Y,Width,Height)

RectInt: 4*4 bytes of signed integers (X,Y,Width,Height)

Size: 4*2 bytes of Q16 (Width,Height)

Color: 4*1 bytes (R,G,B,A)

Viewport: either a Vector3 or a RectQ16, depends on size

FrameValue: either a Vector3 or a Q16 number, depends on size

BinaryScript: a binary value, encoded as Base64 in the XML or YAML file

These are listed in ManilaSDN too.

Any unknown type will use Base64 encoding as default.

The BinaryScript type has an additional functionality: When converting from XML/YAML to mode9 you can use the "file://" notation instead of Base64 strings to include external binary streams. So for example instead of

<Property Name="Script" Value="GwBMAHUAY(...)AAAAAAAAA=" />

You can write

<Property Name="Script" Value="file://somescript.luac" />

But this only holds for Base64 encoded values (e.g: BinaryScript)

Known limitations

If mode9converter finds something new or unconvertable it will usually crash. When editing the XML/YAML files be careful not to break the XML/YAML structure. Or use 6Fg8's mode9 editor, because it's safer.

Licence

Licenced under GPL3, so if you modify it you have to re-release the source code, or I kill you (or something similar)

To get the source code read this

Download

http://winmo.sztupy.hu/manilakitchen.html