+#ifndef SAVE_C
+#define SAVE_C
+
+struct {
+ u8 buf[ 1024 ];
+ u32 len;
+}
+static savedata;
+
+static void skaterift_write_savedata(void){
+ vg_msg sav = {0};
+ sav.buf = savedata.buf;
+ sav.max = sizeof(savedata.buf);
+
+ vg_msg_frame( &sav, "player" );
+
+ if( localplayer.board_view_slot ){
+ struct cache_board *cache_ptr = localplayer.board_view_slot;
+ if( cache_ptr->reg_ptr ){
+ if( cache_ptr->reg_ptr->workshop_id )
+ vg_msg_wkvu64( &sav, "board", cache_ptr->reg_ptr->workshop_id );
+ else
+ vg_msg_wkvstr( &sav, "board", cache_ptr->reg_ptr->foldername );
+ }
+ }
+
+ vg_msg_end_frame( &sav );
+ savedata.len = sav.len;
+
+ FILE *fp = fopen( "save.bkv", "wb" );
+ if( fp ){
+ fwrite( savedata.buf, sav.len, 1, fp );
+ fclose( fp );
+ }
+}
+
+static void skaterift_read_savedata(void){
+ FILE *fp = fopen( "save.bkv", "rb" );
+ if( fp ){
+ savedata.len = fread( savedata.buf, 1, sizeof(savedata.buf), fp );
+ fclose( fp );
+ }
+}
+
+#endif /* SAVE_C */