From: hgn Date: Thu, 3 Jul 2025 14:52:14 +0000 (+0100) Subject: Couple oversights X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=2ae9d6434284373858fe6a869154a640acf9bbbf;p=carveJwlIkooP6JGAAIwe30JlM.git Couple oversights --- diff --git a/src/array_file.c b/src/array_file.c index a90aff2..f97988e 100644 --- a/src/array_file.c +++ b/src/array_file.c @@ -36,7 +36,7 @@ static void af_load_array_file_buffer( array_file_context *ctx, array_file_meta { vg_file_error_info( ctx->fp ); fclose( ctx->fp ); - vg_fatal_exit(); + vg_fatal_error( "AF file buffer error\n" ); } } else @@ -59,7 +59,7 @@ static void af_load_array_file_buffer( array_file_context *ctx, array_file_meta { vg_file_error_info( ctx->fp ); fclose( ctx->fp ); - vg_fatal_exit(); + vg_fatal_error( "AF read arror\n" ); } } } @@ -132,11 +132,7 @@ void af_open( array_file_context *ctx, const char *path, u32 min_version, u32 ma { ctx->fp = fopen( path, "rb" ); if( !ctx->fp ) - { - vg_fatal_condition(); - vg_info( "open('%s'): %s\n", path, strerror(errno) ); - vg_fatal_exit(); - } + vg_fatal_error( "open('%s'): %s\n", path, strerror(errno) ); u64 l = fread( &ctx->header, sizeof(array_file_header), 1, ctx->fp ); if( l != 1 ) @@ -147,13 +143,12 @@ void af_open( array_file_context *ctx, const char *path, u32 min_version, u32 ma if( ctx->header.version < min_version || ctx->header.version > max_version ) { - vg_fatal_condition(); vg_info( "Legacy model version incompatable" ); vg_info( "For model: %s\n", path ); vg_info( " version: %u (min: %u, max: %u)\n", ctx->header.version, min_version, max_version ); fclose( ctx->fp ); - vg_fatal_exit(); + vg_fatal_error( "Legacy\n" ); } af_load_array_file( ctx, &ctx->index, &ctx->header.index, stack, sizeof(array_file_meta) ); diff --git a/src/metascene.c b/src/metascene.c index 7c75699..dc46ed6 100644 --- a/src/metascene.c +++ b/src/metascene.c @@ -107,11 +107,9 @@ static void _cutscene_override_asoc( u32 instance_id, u32 override_index, struct NOT_IMPLEMENTED: - vg_fatal_condition(); - vg_warn( "The data association was not found.\n" - " Entity Type: %u\n" - " Entity name: %s\n", override->entity_type, name ); - vg_fatal_exit(); + vg_fatal_error( "The data association was not found.\n" + " Entity Type: %u\n" + " Entity name: %s\n", override->entity_type, name ); } static void _cutscene_get_strip_asoc( ms_strip *strip, struct cs_asoc *out_asoc ) diff --git a/src/model.c b/src/model.c index 2425b30..6345cd2 100644 --- a/src/model.c +++ b/src/model.c @@ -27,10 +27,9 @@ void mdl_fread_pack_file( mdl_context *mdl, mdl_file *info, void *dst ) { if( !info->pack_size ) { - vg_fatal_condition(); vg_info( "Packed file is only a header; it is not packed" ); vg_info( "path: %s\n", af_str( &mdl->af, info->pstr_path ) ); - vg_fatal_exit(); + vg_fatal_error( "" ); } fseek( mdl->af.fp, mdl->pack_base_offset + info->pack_offset, SEEK_SET ); @@ -210,7 +209,7 @@ void mdl_load_materials( mdl_context *mdl, vg_stack_allocator *stack ) else #endif { - vg_msg_init( &msg, data.data + mat->props.kvs.offset, mat->props.kvs.size ); + vg_msg_init( &msg, data.data? (data.data + mat->props.kvs.offset): NULL, mat->props.kvs.size ); } if( mat->shader == k_shader_standard || @@ -473,11 +472,7 @@ void mdl_async_load_glmesh( mdl_context *mdl, glmesh *mesh, u32 *fixup_table ) vg_async_task_dispatch( task, _sync_mdl_load_glmesh ); } else - { - vg_fatal_condition(); - vg_info( "No vertex/indice data in model file\n" ); - vg_fatal_exit(); - } + vg_fatal_error( "No vertex/indice data in model file\n" ); } /* uploads the glmesh, and textures. everything is saved into the mdl_context */ diff --git a/src/player_render.c b/src/player_render.c index 82dccde..62d2cfd 100644 --- a/src/player_render.c +++ b/src/player_render.c @@ -41,10 +41,7 @@ void player_get_anim( skeleton_anim *out_anim, const char *name ) return; } } - - vg_fatal_condition(); - vg_info( "Failed to find animation '%s' in metascene.\n", name ); - vg_fatal_exit(); + vg_fatal_error( "Failed to find animation '%s' in metascene.\n", name ); } void player_load_animation_reference( const char *path ) diff --git a/src/skaterift.c b/src/skaterift.c index 85c6b07..8857564 100644 --- a/src/skaterift.c +++ b/src/skaterift.c @@ -99,10 +99,12 @@ static void game_load_co( vg_coroutine *co ) { if( !g_client.nosteam ) { - steam_init(); - steam_register_callback( k_iSteamNetConnectionStatusChangedCallBack, on_server_connect_status ); - steam_register_callback( k_iPersonaStateChange, on_persona_state_change ); - request_auth_ticket(); + if( steam_init() ) + { + steam_register_callback( k_iSteamNetConnectionStatusChangedCallBack, on_server_connect_status ); + steam_register_callback( k_iPersonaStateChange, on_persona_state_change ); + request_auth_ticket(); + } } } diff --git a/src/steam.c b/src/steam.c index a5db0f6..f85349b 100644 --- a/src/steam.c +++ b/src/steam.c @@ -228,7 +228,7 @@ void steam_register(void) vg_console_reg_cmd( "ach", steam_achievement_ccmd, NULL ); } -int steam_init(void) +bool steam_init(void) { const char *username = "offline player"; @@ -238,7 +238,7 @@ int steam_init(void) { printf("\n"); vg_error( "Steamworks failed to initialize\n" ); - return 1; + return 0; } steam_ready = 1; diff --git a/src/steam.h b/src/steam.h index c9ecf2b..ad4fd8e 100644 --- a/src/steam.h +++ b/src/steam.h @@ -9,7 +9,7 @@ extern void *hSteamNetworkingSockets, *hSteamUser, *hSteamUserStats; extern char steam_username_at_startup[128]; void steam_register(void); -int steam_init(void); +bool steam_init(void); void steam_update(void); void steam_end(void); u32 str_utf8_collapse( const char *str, char *buf, u32 length );