RCOXML Script: Difference between revisions
mNo edit summary |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
==Reference loaders== | ==Reference loaders== | ||
{{RCO TOC reference | {{RCO TOC reference types}} | ||
=Script= | |||
{| class="wikitable" | |||
|- | |||
! Offset !! Length !! Name !! Example !! Notes | |||
|- | |||
| 0x00 || 0x04 || '''file_offset''' || || VSMX file offset, relative to the start offset of the vsmx data table (always 0) | |||
|- | |||
| 0x04 || 0x04 || '''file_size''' || || VSMX file length | |||
|} | |||
=Example from lftv_tuner_us_en.rco PSP firmware 6.61= | =Example from lftv_tuner_us_en.rco PSP firmware 6.61= | ||
This is how the script functions are triggered by the [[RCOXML Objects]], this is a '''Plane''' object that has lot of brothers in the XML hierarchy that uses the same method, every '''event:script:''' triggers a different function from the [[VSMX]] file | This is how the script functions are triggered by the [[RCOXML Objects]], this is a '''Plane''' object that has lot of brothers in the XML hierarchy that uses the same method, every '''event:script:''' triggers a different function from the [[VSMX]] file | ||
{{Boxcode| | {{Boxcode|code=<syntaxhighlight lang="xml"> | ||
<ObjectTree> | <ObjectTree> | ||
<Page name="remocon_page" pageMode="0x111" pageOnInit="event:script:/main/onInitMainPage" pageOnCancel="nothing" pageOnContext="nothing" pageOnActivate="nothing"> | <Page name="remocon_page" pageMode="0x111" pageOnInit="event:script:/main/onInitMainPage" pageOnCancel="nothing" pageOnContext="nothing" pageOnActivate="nothing"> | ||
Line 28: | Line 38: | ||
And this is what the [[PlayStation JavaScript]] functions does | And this is what the [[PlayStation JavaScript]] functions does | ||
{{Boxcode| | {{Boxcode|code=<syntaxhighlight lang="java"> | ||
// Decompiled VSMX -> Javascript output by Rcomage v1.1.2 | // Decompiled VSMX -> Javascript output by Rcomage v1.1.2 | ||
//Note, this is highly experimental and the output probably sucks. | //Note, this is highly experimental and the output probably sucks. |
Latest revision as of 05:17, 30 August 2021
Description[edit | edit source]
Only one script can be stored inside an .rco file, is indexed in the embedded RCOXML code of the .rco container under the XML element VSMXFile. See Resource Container (RCO) and RCOXML Coding
Is written in PlayStation JavaScript code, and before stored inside the .rco is compiled in VSMX format
The code contains the functions that are available to use by the RCOXML Objects that triggers events with the attribute event:script:
It never was used on any PS3 firmware, none of the PS3 .rco files contains an vsmx script, the format is inherited from PSP so is supposed to work on PS3 too
General concepts[edit | edit source]
Reference loaders[edit | edit source]
reference_type | pointer | Method | Loader | Loads | From | Example (XML) | Notes |
---|---|---|---|---|---|---|---|
0xFFFF0000 | 0xFFFFFFFF | n/a | All | Nothing | None | <Entry reference="nothing"/> |
|
0x04000000 | relative | event: | RCOXML Objects RCOXML Animations |
Code function | Associated .SPRX | <Entry event="event:native:/runFuctionX"/> |
|
ScriptTree/Script | File inside RCO | <Entry event="event:script:/main/runFuctionX"/> |
|||||
0x04010000 | # (0-based) | text: | RCOXML Objects XMBML Code |
TextTree/Text | Strings inside RCO | <Entry text="text:msg_mytext"/> |
|
0x04020000 | absolute | image: | RCOXML Objects XMBML Code |
ImageTree/Image | File inside RCO | <Entry image="image:tex_mytexture"/> |
|
0x04030000 | absolute | model: | RCOXML Objects | ModelTree/Model | File inside RCO | <Entry model="model:mymodel"/> |
|
0x04040000 | absolute ? | sound: ? | associated .SPRX | SoundTree/Sound | File inside RCO | <Entry sound="sound:mysound"/> ? |
speculation |
0x04050000 | absolute | font: | RCOXML Objects | FontTree/Font | File inside RCO ? | <Entry font="font:fontstyle_sanserif"/> |
|
0x04060000 | absolute ? | anim2: ? | RCOXML Objects ? | AnimTree/Animation ? | RCOXML code ? | <Entry anim2="anim2:myanimation"/> ? |
speculation |
0x04070000 | absolute | object2: | RCOXML Objects | ObjectTree/Object | RCOXML code | <Entry object2="object2:plane_myplane"/> |
|
0x04080000 | absolute | anim: | RCOXML Animations | AnimTree/Animation | RCOXML code | <Entry anim="anim:myanimation"/> |
|
0x04090000 | absolute | object: | RCOXML Animations | ObjectTree/Object | RCOXML code | <Entry object="object:plane_myplane"/> |
- A reference attribute is composed by two values, the first is the reference_type that indicates the "tree" of the entry that is going to be loaded, and the second is a pointer to a text string with the label of the entry that is going to be loaded
- The reference_type event doesnt loads an entry from a "tree" though, it runs a code function from either a .sprx (by storing the text native:/ as part of the text string inside the RCO) or from a VSMX script (by storing the text script:/ as part of the text string inside the RCO)
- First two bytes are swapped based on architecture (PSP in little endian, PS3 in big endian). The table shows the values in big endian
Script[edit | edit source]
Offset | Length | Name | Example | Notes |
---|---|---|---|---|
0x00 | 0x04 | file_offset | VSMX file offset, relative to the start offset of the vsmx data table (always 0) | |
0x04 | 0x04 | file_size | VSMX file length |
Example from lftv_tuner_us_en.rco PSP firmware 6.61[edit | edit source]
This is how the script functions are triggered by the RCOXML Objects, this is a Plane object that has lot of brothers in the XML hierarchy that uses the same method, every event:script: triggers a different function from the VSMX file
<ObjectTree> <Page name="remocon_page" pageMode="0x111" pageOnInit="event:script:/main/onInitMainPage" pageOnCancel="nothing" pageOnContext="nothing" pageOnActivate="nothing"> <Plane name="remocon_plane" stdPositionX="82" stdPositionY="136" stdPositionZ="0" stdColorScaleR="1" stdColorScaleG="1" stdColorScaleB="1" stdColorScaleA="1" stdSizeX="149" stdSizeY="272" stdSizeZ="0" stdSizeScaleX="1" stdSizeScaleY="1" stdSizeScaleZ="1" stdAnchorPointMode="0x11" stdOnInit="nothing" planeImage="nothing" planeResizeMode="0x0"> <Plane name="ten_1_button_plane" stdPositionX="18" stdPositionY="-79" stdPositionZ="0" stdColorScaleR="1" stdColorScaleG="1" stdColorScaleB="1" stdColorScaleA="0" stdSizeX="24" stdSizeY="24" stdSizeZ="0" stdSizeScaleX="1" stdSizeScaleY="1" stdSizeScaleZ="1" stdAnchorPointMode="0x11" stdOnInit="nothing" planeImage="image:tex_type_d" planeResizeMode="0x0"> <Button name="ten_1_button" stdPositionX="0" stdPositionY="0" stdPositionZ="0" stdColorScaleR="1" stdColorScaleG="1" stdColorScaleB="1" stdColorScaleA="1" stdSizeX="24" stdSizeY="24" stdSizeZ="0" stdSizeScaleX="1" stdSizeScaleY="1" stdSizeScaleZ="1" stdAnchorPointMode="0x11" stdOnInit="event:native:/OnInitPage500Button" buttonImage="nothing" buttonShadow="nothing" buttonFocus="image:tex_type_d" buttonText="nothing" buttonOnPush="event:script:/main/onPushButton" buttonOnFocusIn="event:script:/main/onFocusIn" buttonOnFocusOut="event:script:/main/onFocusOut" buttonOnFocusLeft="event:script:/main/onFocusLeft" buttonOnFocusRight="event:script:/main/onFocusRight" buttonOnFocusUp="event:script:/main/onFocusUp" buttonOnFocusDown="event:script:/main/onFocusDown" buttonOnContext="nothing" buttonUnknownInt47="0x0"></Button> </Plane> </Plane> </Page> </ObjectTree>
And this is what the PlayStation JavaScript functions does
// Decompiled VSMX -> Javascript output by Rcomage v1.1.2 //Note, this is highly experimental and the output probably sucks. /*0*/ SLIDE_IN_TIME = 100; /*4*/ SINGLE_PUSH_EFFECT_TIME_OUT = 750; /*8*/ ICON_TIME_OUT = 200; /*12*/ gPushedButton = undefined; /*16*/ SetButtonProperty = function(/*localvars=9*/ __var1, __var2, __var3, __var4, __var5, __var6, __var7, __var8) { /* ends at 55 */ /*21*/ __var1.lfLeft = __var2; /*25*/ __var1.lfRight = __var3; /*29*/ __var1.lfUp = __var4; /*33*/ __var1.lfDown = __var5; /*37*/ __var1.lfPushedTexture = __var6; /*41*/ __var1.lfType = __var7; /*45*/ __var1.lfDigit = __var8; /*49*/ __var1.lfFadeoutTimerId = undefined; /*53*/ return null; /*55*/ } /*55*/ onInitMainPage = function(/*localvars=2*/) { /* ends at 281 */ /*60*/ __var1 = this.children.remocon_plane.children; /*67*/ SetButtonProperty( __var1.ten_1_button_plane.children.ten_1_button, undefined, "ten_2_button", undefined, "ten_4_button", "tex_type_d", undefined, 1 ); /*81*/ SetButtonProperty( __var1.ten_2_button_plane.children.ten_2_button, "ten_1_button", "ten_3_button", undefined, "ten_5_button", "tex_type_d", undefined, 2 ); /*95*/ SetButtonProperty( __var1.ten_3_button_plane.children.ten_3_button, "ten_2_button", undefined, undefined, "ten_6_button", "tex_type_d", undefined, 3 ); /*109*/ SetButtonProperty( __var1.ten_4_button_plane.children.ten_4_button, "undefined", "ten_5_button", "ten_1_button", "ten_7_button", "tex_type_d", undefined, 4 ); /*123*/ SetButtonProperty( __var1.ten_5_button_plane.children.ten_5_button, "ten_4_button", "ten_6_button", "ten_2_button", "ten_8_button", "tex_type_d", undefined, 5 ); /*137*/ SetButtonProperty( __var1.ten_6_button_plane.children.ten_6_button, "ten_5_button", undefined, "ten_3_button", "ten_9_button", "tex_type_d", undefined, 6 ); /*151*/ SetButtonProperty( __var1.ten_7_button_plane.children.ten_7_button, "undefined", "ten_8_button", "ten_4_button", "ten_0_button", "tex_type_d", undefined, 7 ); /*165*/ SetButtonProperty( __var1.ten_8_button_plane.children.ten_8_button, "ten_7_button", "ten_9_button", "ten_5_button", "ten_0_button", "tex_type_d", undefined, 8 ); /*179*/ SetButtonProperty( __var1.ten_9_button_plane.children.ten_9_button, "ten_8_button", undefined, "ten_6_button", "ten_0_button", "tex_type_d", undefined, 9 ); /*193*/ SetButtonProperty( __var1.ten_0_button_plane.children.ten_0_button, "ten_7_button", "ten_9_button", "ten_8_button", "jump_button", "tex_type_d", undefined, 0 ); /*207*/ SetButtonProperty( __var1.jump_button_plane.children.jump_button, undefined, "enter_button", "ten_0_button", "chminus_button", "tex_type_a", "Recall", NaN ); /*221*/ SetButtonProperty( __var1.enter_button_plane.children.enter_button, "jump_button", undefined, "ten_0_button", "chplus_button", "tex_type_a", "Enter", NaN ); /*235*/ SetButtonProperty( __var1.chminus_button_plane.children.chminus_button, undefined, "chplus_button", "jump_button", undefined, "tex_type_d", "Minus", NaN ); /*249*/ SetButtonProperty( __var1.chplus_button_plane.children.chplus_button, "chminus_button", undefined, "enter_button", undefined, "tex_type_d", "Plus", NaN ); /*263*/ this.children.remocon_plane.visible = true; /*269*/ this.children.remocon_plane.animPos( 91.0000, 136.000, 0.000000, SLIDE_IN_TIME ); /*279*/ return null; /*281*/ } /*281*/ function remocon(/*localvars=1*/) { /* ends at 328 */ /*284*/ if( gPushedButton != undefined ) { /* ends at 326 */ /*288*/ if( gPushedButton.lfFadeoutTimerId != undefined ) { /* ends at 303 */ /*293*/ timer.clearInterval( gPushedButton.lfFadeoutTimerId ); /*299*/ gPushedButton.lfFadeoutTimerId = undefined; /*303*/ } /*303*/ gPushedButton.parent.animColor( 1.00000, 1.00000, 1.00000, 0.000000, 300 ); /*313*/ gPushedButton.animColor( 1.00000, 1.00000, 1.00000, 1.00000, 100 ); /*322*/ gPushedButton = undefined; /*326*/ } /*326*/ return null; /*328*/ } /*328*/ onReleaseEnter; /*330*/ onTimerFadeButtonTexture = function(/*localvars=2*/ __var1) { /* ends at 366 */ /*335*/ timer.clearInterval( __var1.lfFadeoutTimerId ); /*341*/ __var1.lfFadeoutTimerId = undefined; /*345*/ __var1.parent.animColor( 1.00000, 1.00000, 1.00000, 0.000000, 300 ); /*355*/ __var1.animColor( 1.00000, 1.00000, 1.00000, 1.00000, 100 ); /*364*/ return null; /*366*/ } /*366*/ onPushButton = function(/*localvars=2*/ __var1) { /* ends at 440 */ /*371*/ if( this.lfFadeoutTimerId != undefined ) { /* ends at 386 */ /*376*/ timer.clearInterval( this.lfFadeoutTimerId ); /*382*/ this.lfFadeoutTimerId = undefined; /*386*/ } /*386*/ if( this.lfType == undefined ) { /* ends at 400 */ /*391*/ remocon.onPushButtonTunerUS( true, this.lfDigit, "" ); /*399*/ } else { /* ends at 408 */ /*400*/ remocon.onPushButtonTunerUS( false, 0, this.lfType ); /*408*/ } /*408*/ this.parent.setColor( 1.00000, 1.00000, 1.00000, 1.00000 ); /*417*/ this.setColor( 1.00000, 1.00000, 1.00000, 0.000000 ); /*425*/ gPushedButton = this; /*429*/ this.lfFadeoutTimerId = timer.setInterval( onTimerFadeButtonTexture, SINGLE_PUSH_EFFECT_TIME_OUT, this ); /*438*/ return null; /*440*/ } /*440*/ PrvSetIcon = function(/*localvars=2*/ __var1) { /* ends at 464 */ /*445*/ __var1.texture = resource.texturetable[__var1.lfPushedTexture]; /*453*/ __var1.animColor( 1.00000, 1.00000, 1.00000, 0.000000, ICON_TIME_OUT ); /*462*/ return null; /*464*/ } /*464*/ onFocusIn = function(/*localvars=1*/) { /* ends at 482 */ /*469*/ delete this.texture; /*472*/ this.setColor( 1.00000, 1.00000, 1.00000, 1.00000 ); /*480*/ return null; /*482*/ } /*482*/ onFocusOut = function(/*localvars=1*/) { /* ends at 498 */ /*487*/ if( this.lfPushedTexture != undefined ) { /* ends at 496 */ /*492*/ PrvSetIcon( this ); /*496*/ } /*496*/ return null; /*498*/ } /*498*/ onFocusUp = function(/*localvars=1*/) { /* ends at 530 */ /*503*/ if( gPushedButton == undefined ) { /* ends at 528 */ /*507*/ if( this.lfUp != undefined ) { /* ends at 528 */ /*512*/ this.parent.parent.children[this.lfUp + "_plane"].children[this.lfUp].setFocus(); /*528*/ } /*528*/ } /*528*/ return null; /*530*/ } /*530*/ onFocusDown = function(/*localvars=1*/) { /* ends at 562 */ /*535*/ if( gPushedButton == undefined ) { /* ends at 560 */ /*539*/ if( this.lfDown != undefined ) { /* ends at 560 */ /*544*/ this.parent.parent.children[this.lfDown + "_plane"].children[this.lfDown].setFocus(); /*560*/ } /*560*/ } /*560*/ return null; /*562*/ } /*562*/ onFocusLeft = function(/*localvars=1*/) { /* ends at 594 */ /*567*/ if( gPushedButton == undefined ) { /* ends at 592 */ /*571*/ if( this.lfLeft != undefined ) { /* ends at 592 */ /*576*/ this.parent.parent.children[this.lfLeft + "_plane"].children[this.lfLeft].setFocus(); /*592*/ } /*592*/ } /*592*/ return null; /*594*/ } /*594*/ onFocusRight = function(/*localvars=1*/) { /* ends at 626 */ /*599*/ if( gPushedButton == undefined ) { /* ends at 624 */ /*603*/ if( this.lfRight != undefined ) { /* ends at 624 */ /*608*/ this.parent.parent.children[this.lfRight + "_plane"].children[this.lfRight].setFocus(); /*624*/ } /*624*/ } /*624*/ return null; /*626*/ }
|