diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 5db0b3b0..783a31b5 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -480,6 +480,11 @@ int main( int argc, char** argv ) badVer.state = tracy::BadVersionState::UnsupportedVersion; badVer.version = e.version; } + catch( const tracy::LegacyVersion& e ) + { + badVer.state = tracy::BadVersionState::LegacyVersion; + badVer.version = e.version; + } } ); } } diff --git a/server/TracyBadVersion.cpp b/server/TracyBadVersion.cpp index aa9667a9..9a5bdf17 100644 --- a/server/TracyBadVersion.cpp +++ b/server/TracyBadVersion.cpp @@ -22,24 +22,13 @@ void BadVersionImpl( BadVersionState& badVer ) case BadVersionState::UnsupportedVersion: ImGui::OpenPopup( "Unsupported file version" ); break; + case BadVersionState::LegacyVersion: + ImGui::OpenPopup( "Legacy file version" ); + break; default: assert( false ); break; } - if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) - { -#ifdef TRACY_EXTENDED_FONT - TextCentered( ICON_FA_CLOUD_DOWNLOAD_ALT ); -#endif - ImGui::Text( "The file you are trying to open is unsupported.\nYou should update to tracy %i.%i.%i or newer and try again.", badVer.version >> 16, ( badVer.version >> 8 ) & 0xFF, badVer.version & 0xFF ); - ImGui::Separator(); - if( ImGui::Button( "I understand" ) ) - { - ImGui::CloseCurrentPopup(); - badVer.state = BadVersionState::Ok; - } - ImGui::EndPopup(); - } if( ImGui::BeginPopupModal( "Bad file", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) { #ifdef TRACY_EXTENDED_FONT @@ -54,6 +43,34 @@ void BadVersionImpl( BadVersionState& badVer ) } ImGui::EndPopup(); } + if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) + { +#ifdef TRACY_EXTENDED_FONT + TextCentered( ICON_FA_CLOUD_DOWNLOAD_ALT ); +#endif + ImGui::Text( "The file you are trying to open is unsupported.\nYou should update to tracy %i.%i.%i or newer and try again.", badVer.version >> 16, ( badVer.version >> 8 ) & 0xFF, badVer.version & 0xFF ); + ImGui::Separator(); + if( ImGui::Button( "I understand" ) ) + { + ImGui::CloseCurrentPopup(); + badVer.state = BadVersionState::Ok; + } + ImGui::EndPopup(); + } + if( ImGui::BeginPopupModal( "Legacy file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) + { +#ifdef TRACY_EXTENDED_FONT + TextCentered( ICON_FA_GHOST ); +#endif + ImGui::Text( "You are trying to open a file which was created by legacy version %i.%i.%i.\nUse the update utility from an older version of the profiler to convert the file to a supported version.", badVer.version >> 16, ( badVer.version >> 8 ) & 0xFF, badVer.version & 0xFF ); + ImGui::Separator(); + if( ImGui::Button( "Maybe I don't need it" ) ) + { + ImGui::CloseCurrentPopup(); + badVer.state = BadVersionState::Ok; + } + ImGui::EndPopup(); + } } } diff --git a/server/TracyBadVersion.hpp b/server/TracyBadVersion.hpp index 530242e9..770f37e8 100644 --- a/server/TracyBadVersion.hpp +++ b/server/TracyBadVersion.hpp @@ -12,7 +12,8 @@ struct BadVersionState { Ok, BadFile, - UnsupportedVersion + UnsupportedVersion, + LegacyVersion }; State state = Ok; diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 2acbc89c..89945117 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -47,6 +47,12 @@ struct UnsupportedVersion : public std::exception int version; }; +struct LegacyVersion : public std::exception +{ + LegacyVersion( int version ) : version ( version ) {} + int version; +}; + struct LoadProgress { enum Stage diff --git a/update/src/update.cpp b/update/src/update.cpp index 5ed8754a..66a3e5ab 100644 --- a/update/src/update.cpp +++ b/update/src/update.cpp @@ -91,6 +91,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::LegacyVersion& e ) + { + fprintf( stderr, "The file you are trying to open is from a legacy version.\n" ); + exit( 1 ); + } return 0; }