diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index d7e31574..2d77345a 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -581,6 +581,10 @@ static void DrawContents() { badVer.state = tracy::BadVersionState::BadFile; } + catch( const tracy::FileReadError& ) + { + badVer.state = tracy::BadVersionState::ReadError; + } } } diff --git a/server/TracyBadVersion.cpp b/server/TracyBadVersion.cpp index 9a5bdf17..ce4ea3b6 100644 --- a/server/TracyBadVersion.cpp +++ b/server/TracyBadVersion.cpp @@ -19,6 +19,9 @@ void BadVersionImpl( BadVersionState& badVer ) case BadVersionState::BadFile: ImGui::OpenPopup( "Bad file" ); break; + case BadVersionState::ReadError: + ImGui::OpenPopup( "File read error" ); + break; case BadVersionState::UnsupportedVersion: ImGui::OpenPopup( "Unsupported file version" ); break; @@ -43,6 +46,20 @@ void BadVersionImpl( BadVersionState& badVer ) } ImGui::EndPopup(); } + if( ImGui::BeginPopupModal( "File read error", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) + { +#ifdef TRACY_EXTENDED_FONT + TextCentered( ICON_FA_EXCLAMATION_TRIANGLE ); +#endif + ImGui::Text( "The file you are trying to open cannot be mapped to memory." ); + ImGui::Separator(); + if( ImGui::Button( "OK" ) ) + { + ImGui::CloseCurrentPopup(); + badVer.state = BadVersionState::Ok; + } + ImGui::EndPopup(); + } if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) { #ifdef TRACY_EXTENDED_FONT diff --git a/server/TracyBadVersion.hpp b/server/TracyBadVersion.hpp index 770f37e8..5cc3023a 100644 --- a/server/TracyBadVersion.hpp +++ b/server/TracyBadVersion.hpp @@ -12,6 +12,7 @@ struct BadVersionState { Ok, BadFile, + ReadError, UnsupportedVersion, LegacyVersion }; diff --git a/server/TracyView.cpp b/server/TracyView.cpp index f721adf4..9d1eec5c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -9768,6 +9768,10 @@ void View::DrawCompare() { m_compare.badVer.state = BadVersionState::BadFile; } + catch( const tracy::FileReadError& ) + { + m_compare.badVer.state = BadVersionState::ReadError; + } } } tracy::BadVersion( m_compare.badVer ); diff --git a/update/src/update.cpp b/update/src/update.cpp index d7b4bf25..26d1968f 100644 --- a/update/src/update.cpp +++ b/update/src/update.cpp @@ -139,6 +139,11 @@ int main( int argc, char** argv ) fprintf( stderr, "The file you are trying to open is not a tracy dump.\n" ); exit( 1 ); } + catch( const tracy::FileReadError& e ) + { + fprintf( stderr, "The file you are trying to open cannot be mapped to memory.\n" ); + exit( 1 ); + } catch( const tracy::LegacyVersion& e ) { fprintf( stderr, "The file you are trying to open is from a legacy version.\n" );