-VG_STATIC void workshop_visibile_load_loop_thread( void *_args )
-{
- char path[1024];
- for( u32 i=0; i<SKATESHOP_BOARD_CACHE_MAX; i++ ){
- struct cache_board *cache_ptr = &global_skateshop.cache[i];
-
- SDL_AtomicLock( &global_skateshop.sl_cache_access );
- if( cache_ptr->state == k_cache_board_state_load_request ){
- if( cache_ptr->registry_id >= global_skateshop.registry_count ){
- /* should maybe have a different value for this case */
- cache_ptr->state = k_cache_board_state_none;
- SDL_AtomicUnlock( &global_skateshop.sl_cache_access );
- continue;
- }
-
- /* continue with the request */
- SDL_AtomicUnlock( &global_skateshop.sl_cache_access );
-
- struct registry_board *reg =
- &global_skateshop.registry[ cache_ptr->registry_id ];
-
- if( reg->workshop_id ){
- vg_async_item *call =
- vg_async_alloc( sizeof(struct async_workshop_filepath_info) );
-
- struct async_workshop_filepath_info *info = call->payload;
- info->buf = path;
- info->id = reg->workshop_id;
- info->len = vg_list_size(path) - strlen("/board.mdl")-1;
- vg_async_dispatch( call, async_workshop_get_filepath );
- vg_async_stall(); /* too bad! */
-
- if( path[0] == '\0' ){
- SDL_AtomicLock( &global_skateshop.sl_cache_access );
- cache_ptr->state = k_cache_board_state_none;
- SDL_AtomicUnlock( &global_skateshop.sl_cache_access );
-
- vg_error( "Failed SteamAPI_GetItemInstallInfo(" PRINTF_U64 ")\n",
- reg->workshop_id );
- continue;
- }
- else{
- strcat( path, "/board.mdl" );
- }
- }
- else{
- snprintf( path, 256, "models/boards/%s", reg->filename );
- }
-
- player_board_load( &cache_ptr->board, path );
- vg_async_call( skateshop_async_board_loaded, cache_ptr, 0 );
- }
- else
- SDL_AtomicUnlock( &global_skateshop.sl_cache_access );
- }
- vg_async_call( workshop_async_any_complete, NULL, 0 );