Fetch the startup trace instead of preloading the embedded one.

The preloaded data package made every ?t= load download embed.tracy
as well. The startup glue now fetches embed.tracy only when no URL is
given, into the same /url.tracy slot, and the boot code has a single
open path.
This commit is contained in:
Bartosz Taudul
2026-09-12 21:56:19 +02:00
parent 1fb370f935
commit af3432cfde
4 changed files with 77 additions and 87 deletions

View File

@@ -246,25 +246,17 @@ int main( int argc, char** argv )
if( f ) fclose( f );
return f != nullptr;
};
const bool hasUrl = FileExists( "/url.tracy" ) || FileExists( "/url.tracy.failed" );
if( hasUrl )
if( FileExists( "/url.tracy" ) )
{
try
{
if( FileExists( "/url.tracy" ) )
{
initFileOpen.reset( tracy::FileRead::Open( "/url.tracy" ) );
}
initFileOpen.reset( tracy::FileRead::Open( "/url.tracy" ) );
}
catch( const tracy::NotTracyDump& ) { EM_ASM( alert( "The provided URL did not contain a valid Tracy trace." ) ); }
catch( const tracy::FileReadError& ) { EM_ASM( alert( "The trace from the provided URL could not be read." ) ); }
catch( const tracy::UnsupportedVersion& ) { EM_ASM( alert( "The trace from the provided URL requires a newer version of Tracy." ) ); }
catch( const tracy::LegacyVersion& ) { EM_ASM( alert( "The trace from the provided URL is in a legacy format." ) ); }
}
else
{
initFileOpen = std::unique_ptr<tracy::FileRead>( tracy::FileRead::Open( "embed.tracy" ) );
}
#endif
if( argc == 2 )
{
@@ -397,10 +389,6 @@ int main( int argc, char** argv )
{
view.store( std::make_shared<tracy::View>( RunOnMainThread, *initFileOpen, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_achievements ), std::memory_order_release );
}
catch( const tracy::UnsupportedVersion& )
{
EM_ASM( alert( "The trace from the provided URL requires a newer version of Tracy." ) );
}
catch( const std::exception& e )
{
const std::string msg = std::string( "Failed to load the trace: " ) + e.what();