• twitter
  • facebook
  • rules
  • news

[APP] Command line Mode9 Tools

  • Retweet Thread
  • Vote for Thread to be Featured on the XDA Portal
Default [APP] Command line Mode9 Tools

This topic hosts various command line tools that ease mode9 editing. These tools are for command line users, so if you don't like it, then use 6Fg8's mode9editor

The tools are:
mode9converter

This tool will convert binary mode9 files to/from XML or YAML file formats.

mode9designer

Mode9Designer is a rendering engine built on OpenGL that allows one to create applications that renders mode9 files. It's a DLL not a tool

m9show

m9show is a simple application that uses mode9designer to render a specific Character from a mode9 file

ManilaSDN

ManilaSDN is a wiki with information about Manila development, including a reference (documentation) to the mode9 files

__________________
http://winmo.sztupy.hu

The guy behind the Lua 5.1 decompiler.

The usual "If you like my work give money" link

Phones: Omnia, Galaxy S, Touch Pro

Last edited by sztupy; 24th March 2009 at 02:49 AM.

Default 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

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

You can write

Code:
<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

__________________
http://winmo.sztupy.hu

The guy behind the Lua 5.1 decompiler.

The usual "If you like my work give money" link

Phones: Omnia, Galaxy S, Touch Pro

Last edited by sztupy; 24th March 2009 at 02:18 AM.
Default mode9designer

Mode9 designer
and m9show

Mode9 designer is a plugin that will add mode9 displaying capabilities to your application. It's a DLL, with simple to use commands like "AddToGroup", or "SetPosition". It's specification can be found at the ManilaSDN. (This is a DLL because I actually hope 6Fg8 will implement this in the near future )

If you want to get a showcase of mode9designers capabilities I made a command line tool that will display a specific library item from a mode9 file (that can be in binary, xml or yaml form)

To use it, first convert all image files to png's, and create the following directory structure:

Code:
directory
  - m9show.exe
  - mode9designer.dll
  - mode9_tags.yaml
  - windows
       - all files in hashed form (like 6ecd0c00_manila.png)
       - htc
           - assets
               - images
                  ... all files in unhashed form (like dottedline.png)

To get the above structure the easiest way, you might use Manilakitchen, where the "src" directory it creates is ideal to showcase m9show.

Next run m9show with the following parameters:

Code:
m9show [-h] [-o] mode9file characterID

where mode9file is a mode9 file, either in binary or in XML or YAML format, and characterID is the ID of the library you want to view. (enter -1 to view the scene object). -h will convert the output to WQVGA and -o will disallow changing of the visibility/opacity of objects, so everything will be visible in the output.

For example to see Character no12 from home.mode9 (the main library item in home.mode9) use:

Code:
m9show home.mode9.xml 12

You might want to try these too:

Code:
m9show album.mode9.xml 10
m9show calendar.mode9.xml 15
m9show manila.mode9.xml -1

The result will be:



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

Known bugs/limitations:

Lots. The main is that m9show won't load characterreferences, so you can only display one character at a time (or the Scene). There are still a lot of unsolved things from the mode9 files, and already solved things might still break. The API of mode9designer might change a lot too (but existing commands should stay as they are)

__________________
http://winmo.sztupy.hu

The guy behind the Lua 5.1 decompiler.

The usual "If you like my work give money" link

Phones: Omnia, Galaxy S, Touch Pro

Last edited by sztupy; 24th March 2009 at 02:55 AM.
Default MSDN - Manila software development network :)

I've set up a wiki and added some generated content with the information of the mode9 files. I named this wiki MSDN . Feel free to edit it and comment on the things that are there. Later I'll add some information from the lua files too.

Link: http://msdn.winmo.sztupy.hu

__________________
http://winmo.sztupy.hu

The guy behind the Lua 5.1 decompiler.

The usual "If you like my work give money" link

Phones: Omnia, Galaxy S, Touch Pro

Last edited by sztupy; 24th March 2009 at 02:42 AM.

Reserved for another tool I might create.

__________________
http://winmo.sztupy.hu

The guy behind the Lua 5.1 decompiler.

The usual "If you like my work give money" link

Phones: Omnia, Galaxy S, Touch Pro

what a great tools!

thanks man!


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Rules
Forum Jump
 
All times are GMT +1. The time now is 04:13 AM.