+static void skaterift_restore_state(void){
+ savedata_file sav;
+ strcpy( sav.path, str_skaterift_main_save );
+ savedata_file_read( &sav );
+
+ vg_msg kvsav;
+ vg_msg_init( &kvsav, sav.buf, sizeof(sav.buf) );
+
+ u32 board_reg_id = 0,
+ player_reg_id = 0;
+
+ vg_msg_cursor orig = kvsav.cur;
+
+ if( vg_msg_seekframe( &kvsav, "player" ) ){
+ addon_alias q;
+
+ /* board */
+ skaterift_read_addon_alias( &kvsav, "board", k_addon_type_board, &q );
+ u32 reg_id = addon_match( &q );
+ if( reg_id != 0xffffffff )
+ board_reg_id = reg_id;
+
+ /* playermodel */
+ skaterift_read_addon_alias( &kvsav, "playermodel",
+ k_addon_type_player, &q );
+ reg_id = addon_match( &q );
+ if( reg_id != 0xffffffff )
+ player_reg_id = reg_id;
+ }
+
+ localplayer.board_view_slot =
+ addon_cache_create_viewer( k_addon_type_board, board_reg_id );
+ localplayer.playermodel_view_slot =
+ addon_cache_create_viewer( k_addon_type_player, player_reg_id );
+
+ kvsav.cur = orig;
+}
+
+static addon_reg *skaterift_mount_world_unloadable( const char *path ){
+ addon_reg *reg = addon_mount_local_addon( path, k_addon_type_world, ".mdl" );
+ reg->flags |= ADDON_REG_HIDDEN;
+ return reg;
+}
+
+static void vg_load(void){
+ if( k_tools_mode ){
+ vg_async_call( async_call_ready, NULL, 0 );
+ return;
+ }
+
+ vg_console_reg_cmd( "load_world", skaterift_load_world_command, NULL );
+ vg_console_reg_cmd( "switch_active_instance",
+ skaterift_switch_instance_cmd, NULL );
+