RCOXML Script: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
mNo edit summary
m (→‎PSP Example: have fun with it ;)
Line 13: Line 13:
{{RCOXML reference loaders}}
{{RCOXML reference loaders}}


=PSP Example=
=Example from lftv_tuner_us_en.rco PSP firmware 6.61=
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|content=<syntaxhighlight lang="xml">
{{Boxcode|content=<syntaxhighlight lang="xml">
Line 21: Line 19:
<Button name="jump_button" stdPositionX="0" stdPositionY="0" stdPositionZ="0" stdColorScaleR="1" stdColorScaleG="1" stdColorScaleB="1" stdColorScaleA="1" stdSizeX="62" stdSizeY="13" stdSizeZ="0" stdSizeScaleX="1" stdSizeScaleY="1" stdSizeScaleZ="1" stdAnchorPointMode="0x11" stdOnInit="event:native:/OnInitPage500Button" buttonImage="nothing" buttonShadow="nothing" buttonFocus="image:tex_type_a" 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>
<Button name="jump_button" stdPositionX="0" stdPositionY="0" stdPositionZ="0" stdColorScaleR="1" stdColorScaleG="1" stdColorScaleB="1" stdColorScaleA="1" stdSizeX="62" stdSizeY="13" stdSizeZ="0" stdSizeScaleX="1" stdSizeScaleY="1" stdSizeScaleZ="1" stdAnchorPointMode="0x11" stdOnInit="event:native:/OnInitPage500Button" buttonImage="nothing" buttonShadow="nothing" buttonFocus="image:tex_type_a" 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>
</syntaxhighlight>}}
And this is what the [[PlayStation JavaScript]] functions does
{{Boxcode|content=<syntaxhighlight lang="java">
// 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*/ }
</syntaxhighlight>}}
</syntaxhighlight>}}


{{File Formats}}
{{File Formats}}
<noinclude>[[Category:Main]]</noinclude>
<noinclude>[[Category:Main]]</noinclude>

Revision as of 10:20, 4 September 2016

Description

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

Reference loaders

Template:RCOXML reference loaders

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

Code Sample

And this is what the PlayStation JavaScript functions does

Code Sample