Metapyziks / SourceUtils

Source engine file format exporting / WebGL map viewer demo.
MIT License
144 stars 19 forks source link

WebExport crashes on (skybox) files #55

Open DevRuto opened 6 years ago

DevRuto commented 6 years ago

https://i.imgur.com/6aYcS1W.png (thanks to Ocelot) Occurs on attempting to export kz_unity_01 and kz_ziggurath_final

DevRuto commented 5 years ago

Unable to export kz_zxp_interstellar_v2, kz_htc_purgatory, and kz_blackness

DaLLuZZ commented 2 years ago

turning off --verbose option prevents it from crashes

I'm facing exactly the same problem when the program tries to export the vertigoblue skybox which is the standard csgo one

It seems that its name should contain "_hdr", so it should be vertigoblue_hdr instead But this is what happens during surf_ameliorate export

[19/336] Exporting '/materials/skybox/vertigoblue_rt.vtf.json' ... Failed
[20/336] Exporting '/materials/skybox/vertigoblue_lf.vtf.json' ... Failed
[21/336] Exporting '/materials/skybox/vertigoblue_bk.vtf.json' ... Failed
[22/336] Exporting '/materials/skybox/vertigoblue_ft.vtf.json' ... Failed
[23/336] Exporting '/materials/skybox/vertigoblue_up.vtf.json' ... Failed
[24/336] Exporting '/materials/skybox/vertigoblue_dn.vtf.json' ... Failed

I decompiled surf_ameliorate using bspsrc. It turned out that the map itself uses skyname with "_hdr" postfix

"skyname" "vertigoblue_hdr"

Perhaps the program incorrectly reads the skyname from the .bsp file, so it looks like this issue is duplicate of https://github.com/Metapyziks/SourceUtils/issues/12

DaLLuZZ commented 2 years ago

There is a way to get rid of program crashes without removing the --verbose option from the program launch options https://github.com/Metapyziks/SourceUtils/blob/0f15906b4d1f2a6afb4e781aa648c4e5ede68663/SourceUtils.WebExport/Export.cs#L233-L250 It is necessary to check e.Response for null in order to avoid crashing the program

catch ( WebException e )
{
    ++failed;

    if ( args.Verbose )
    {
        Console.ForegroundColor = ConsoleColor.DarkRed;
        Console.WriteLine("Failed");

        if ( e.Response != null)
        {
            using ( var stream = e.Response.GetResponseStream() )
            {
                using ( var reader = new StreamReader( stream ) )
                {
                    Console.WriteLine( reader.ReadToEnd() );
                }
            }
        }
        else
            Console.WriteLine("Null Response");
    }
}

But this will not solve the problem with the skybox itself, it will only save the program from crashing and make it possible to continue exporting without restarting. Judging by the behavior of the program during the export of the skybox, the problem is in some kind of infinite loop

Worth a look at this method https://github.com/Metapyziks/SourceUtils/blob/e64dd0bdffc4d60e348b24c748fc785f96f3563f/SourceUtils.WebExport/Material.cs#L294-L345