I never really thought I'd actually bother, but I have been doing some investigation into the VSMX file format, found in RCOs from video/music UMDs and two of the lftv RCOs in the PSP's flash0.
The VSMX file is basically a compiled script file which controls stuff like the UMD menus. I don't know whether VSMX scripts can be used in the XMB or not.
From a string constant I've seen in one of them, I'm guessing that the official Sony script compiler takes a Javascript file as input and outputs the compiled VSMX file, so I will consider a number of things here from a Javascript perspective.
So anyway, this post is just for anyone who happens to be interested in the file format, and doesn't really serve much other purpose. It's also rather "preliminary" in that it's _really_ incomplete (I've spent some time on this, but not that much).
Okay...
General File Layout
...basically looks like this:
VSMX header
Compiled instructions
String constants
Object property/method names?
Variable/function names
VSMX header
Code:
Offset Description
0x00 ASCII text "VSMX"
0x04 always 0x10000 (probably version)
0x08 always 0x34 - probably length of this header or offset of compiled instructions section
0x0C length of compiled instructions section
0x10 offset of string constants section
0x14 length of above section
0x18 number of string constants? (haven't double checked this)
0x1C offset of property/method names section
0x20 length of above section
0x24 number of property/method names in above section
0x28 offset of variable/function names section
0x2C length of above section
0x30 number of variable/function names in above section
|
Compiled Instructions
The compiled instructions start at offset 0x34. An important concept here, I'll refer to as a "group". A group is a 64-bit sequence, consisting of 2 32-bit values. The compiled instructions section is entirely made of these groups.
The first value of the group is the identifier and the second specifies any additional information, or is 0 if not used (I will refer to this second value as the argument).
Here's a list of the identifiers that I know:
Code:
Identifier Description
0x01 assign operator (=)
0x02 string concatenation operator, or perhaps just addition
0x08 negate operator (unary)
0x0E equivalence operator (==)
0x0F less than or equal operator (<=) [am not totally sure about this one]
0x22 end of statement operator? (basically what ";" does)
0x23 "null" constant?
0x24
0x25 boolean constant?
0x26 integer constant
0x27 float constant
0x28 string constant; the argument is an index to a constant in the string constants section of this file (that is, 0 = first string constant, 1 = second string constant etc)
0x2C
0x2D unnamed variable? argument is some sort of index/identifier
0x2E variable; argument is an index in the variable/function names section
0x2F object property; argument is an index in the property/method names section
0x30 object method (argument, same as above)
0x31 ? seems to reference property/method names section
0x34 array index operator (basically what [ ... ] does)
0x36 assign as array item???
0x39 begin function? argument is the group index where the function ends, eg if the argument is 0x50, the function would end at 0x50 * 8 + 0x34 = 0x2B4 (absolute file offset)
0x3A pointer to "0x3B group" - this acts like an OR operator
0x3B start conditional (if) block? like above two, argument is the group index of where the block ends
0x3C call function; the argument here specifies the number of arguments to be passed to the function
0x3D like above, except it calls an object method
0x3E invoke inbuilt function???
0x3F return statement???
|
For structure, the variables/constants are just listed and operators apply to previous things.
For example, take the following hex sequence of 32-bit values:
Code:
0x2E 0x00 0x26 0x0C 0x01 0x00 0x22 0x00
|
(for reference purposes, wee'll assume the first variable name is "myVariable")
The above translates to the following Javascript:
Back to the hex, basically it means:
Code:
{variable-index}0 ("myVariable"), {integer}12, {assign}, {end-statement}
|
The assign operator gets applied to the previous two values, which happen to be "myVariable" and "12" and does its job on the two.
String constants
This is just a list of unicode (UTF-16) string constants, separated by a single null character (remember, null characters are 16 bits wide in unicode). There is no alignment.
Object property/method names
Pretty much the same as the string constants section.
Variable/function names
Like above section, except ASCII instead of unicode.