+
+ vg_function_push( (struct vg_cmd){
+ .name = "list",
+ .function = vg_console_list
+ });
+
+ // Read and exec persistent commands
+ FILE *fp = fopen( "cfg/auto.conf", "r" );
+ if( fp )
+ {
+ char line[256];
+
+ while( fgets( line, sizeof( line ), fp ) )
+ {
+ line[ strcspn( line, "\r\n#" ) ] = 0x00;
+
+ if( line[0] != 0x00 )
+ {
+ execute_console_input( line );
+ }
+ }
+
+ fclose( fp );
+ }
+}
+
+static void vg_console_write_persistent(void)
+{
+ FILE *fp = fopen( "cfg/auto.conf", "w" );
+
+ for( int i = 0; i < arrlen( vg_console.convars ); i ++ )
+ {
+ struct vg_convar *cv = &vg_console.convars[i];
+
+ if( cv->persistent )
+ {
+ switch( cv->data_type )
+ {
+ case k_convar_dtype_i32:
+ fprintf( fp, "%s %d\n", cv->name, *(i32 *)(cv->data) );
+ break;
+ case k_convar_dtype_u32:
+ fprintf( fp, "%s %u\n", cv->name, *(u32 *)(cv->data) );
+ break;
+ case k_convar_dtype_f32:
+ fprintf( fp, "%s %.5f\n", cv->name, *(float *)(cv->data ) );
+ break;
+ }
+ }
+ }
+
+ fclose( fp );