X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=network.c;h=27048fb8886231e58bd785863fd7915e5d360c22;hb=61d4952a59c72dab12aa5cb9100d4433b2cdcedf;hp=4c9c61afd7424fb9e5d9fd66da47cacc3851e390;hpb=8f2a6f95c2862cea9c1cf800628cd4f4c630e30b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network.c b/network.c index 4c9c61a..27048fb 100644 --- a/network.c +++ b/network.c @@ -11,14 +11,19 @@ #include "world.h" #include "world_sfd.h" #include "world_routes.h" -#include "vg/vg_imgui.h" +#include "vg/vg_ui/imgui.h" #include "gui.h" #include "ent_region.h" #include "vg/vg_loader.h" -#include -#include -#include +#ifdef _WIN32 + #include + #include +#else + #include + #include + #include +#endif struct network_client network_client = { @@ -369,11 +374,14 @@ void render_server_status_gui(void) { render_fb_bind( gpipeline.fb_workshop_preview, 0 ); + vg_ui_set_screen( 128, 48 ); + ui_context *ctx = &vg_ui.ctx; + /* HACK */ - vg_ui.cur_vert = 0; - vg_ui.cur_indice = 0; - vg_ui.vert_start = 0; - vg_ui.indice_start = 0; + ctx->cur_vert = 0; + ctx->cur_indice = 0; + ctx->vert_start = 0; + ctx->indice_start = 0; ui_rect r = { 0, 0, 128, 48 }; @@ -384,9 +392,9 @@ void render_server_status_gui(void) u32 bg = 0xff000000; network_status_string( &str, &bg ); - ui_fill( r, bg ); - ui_text( r, buf, 1, k_ui_align_center, 0 ); - ui_flush( k_ui_shader_colour, 128, 48 ); + ui_fill( ctx, r, bg ); + ui_text( ctx, r, buf, 1, k_ui_align_center, 0 ); + ui_flush( ctx, k_ui_shader_colour, NULL ); skaterift.rt_textures[ k_skaterift_rt_server_status ] = gpipeline.fb_workshop_preview->attachments[0].id; @@ -613,7 +621,22 @@ static void network_resolve_host_thread( void *_ ) &hints, &result); if( s != 0 ) { +#ifndef _WIN32 vg_error( "getaddrinfo: %s\n", gai_strerror(s) ); +#endif + + if( !strcmp( network_client.host_adress, "skaterift.com" ) ) + { + vg_warn( "getaddrinfo failed for skaterift.com;\n " + "falling back to a hardcoded IPv4\n" ); + strcpy( network_client.host_adress, "46.101.34.155" ); + SteamAPI_SteamNetworkingIPAddr_ParseString( + &network_client.ip, + network_client.host_adress ); + network_client.ip.m_port = NETWORK_PORT; + *status = 1; + } + goto end; }