+ log_info( "output_path: '%s'\n", api.output_path );
+ log_info( "vmf_name: '%s'\n", api.vmf_name );
+
+ api.map = vmf_init( api.strings[0].str );
+ if( api.map )
+ {
+ // Update arg inferred types
+ api.strings[0].type = k_iftype_vmf;
+ for( int i = 1; i < api.num_strings; i ++ )
+ {
+ if( vmf_visgroup_id( api.map->root, api.strings[i].str ) != -1 )
+ api.strings[i].type = k_iftype_visgroup;
+ else
+ api.strings[i].type = k_iftype_classname;
+ }
+
+ if( !extension )
+ extension = "csr_substance";
+
+ csr_so ext = csr_libopen( extension );
+
+ if( ext )
+ {
+ void (*csr_ext_main)(csr_api *);
+ void (*csr_ext_exit)(csr_api *);
+
+ csr_ext_main = csr_get_proc( ext, "csr_ext_main" );
+ csr_ext_exit = csr_get_proc( ext, "csr_ext_exit" );
+
+ if( csr_ext_main && csr_ext_exit )
+ {
+ csr_ext_main( &api );
+
+ // Do other
+ if( api.write_txt )
+ {
+ char radar_path[512];
+ strcpy( radar_path, api.output_path );
+ strcat( radar_path, ".txt" );
+ csr_write_txt( radar_path, api.vmf_name, &api.target );
+ }
+
+ csr_ext_exit( &api );
+ }
+ else
+ {
+ csr_liberr();
+ }
+
+ csr_libclose( ext );
+ }
+ else
+ {
+ csr_liberr();
+ }
+
+ vmf_free( api.map );
+ }
+ else
+ {
+ log_error( "Could not load VMF\n" );
+ }
+ }
+ else
+ {
+ log_error( "Missing required argument: mapfile\n" );