mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
Move bad version dialogs to a separate file.
This commit is contained in:
parent
ea2be1bce9
commit
28380f2d25
50
server/TracyBadVersion.cpp
Normal file
50
server/TracyBadVersion.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "TracyBadVersion.hpp"
|
||||||
|
#include "TracyImGui.hpp"
|
||||||
|
|
||||||
|
namespace tracy
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
void BadVersionImpl( int& badVer )
|
||||||
|
{
|
||||||
|
assert( badVer != 0 );
|
||||||
|
|
||||||
|
if( badVer > 0 )
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup( "Unsupported file version" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup( "Bad file" );
|
||||||
|
}
|
||||||
|
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||||
|
{
|
||||||
|
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 >> 16, ( badVer >> 8 ) & 0xFF, badVer & 0xFF );
|
||||||
|
ImGui::Separator();
|
||||||
|
if( ImGui::Button( "I understand" ) )
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
badVer = 0;
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
if( ImGui::BeginPopupModal( "Bad file", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||||
|
{
|
||||||
|
ImGui::Text( "The file you are trying to open is not a tracy dump." );
|
||||||
|
ImGui::Separator();
|
||||||
|
if( ImGui::Button( "Oops" ) )
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
badVer = 0;
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
18
server/TracyBadVersion.hpp
Normal file
18
server/TracyBadVersion.hpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef __TRACYBADVERSION_HPP__
|
||||||
|
#define __TRACYBADVERSION_HPP__
|
||||||
|
|
||||||
|
#include "../common/TracyForceInline.hpp"
|
||||||
|
|
||||||
|
namespace tracy
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
void BadVersionImpl( int& badVer );
|
||||||
|
}
|
||||||
|
|
||||||
|
tracy_force_inline void BadVersion( int& badVer ) { if( badVer != 0 ) detail::BadVersionImpl( badVer ); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -89,6 +89,7 @@
|
|||||||
<ClCompile Include="..\..\..\imgui\imgui_draw.cpp" />
|
<ClCompile Include="..\..\..\imgui\imgui_draw.cpp" />
|
||||||
<ClCompile Include="..\..\..\nfd\nfd_common.c" />
|
<ClCompile Include="..\..\..\nfd\nfd_common.c" />
|
||||||
<ClCompile Include="..\..\..\nfd\nfd_win.cpp" />
|
<ClCompile Include="..\..\..\nfd\nfd_win.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\server\TracyBadVersion.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
|
<ClCompile Include="..\..\..\server\TracyMemory.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyView.cpp" />
|
<ClCompile Include="..\..\..\server\TracyView.cpp" />
|
||||||
<ClCompile Include="..\..\..\server\TracyWorker.cpp" />
|
<ClCompile Include="..\..\..\server\TracyWorker.cpp" />
|
||||||
@ -115,6 +116,7 @@
|
|||||||
<ClInclude Include="..\..\..\nfd\common.h" />
|
<ClInclude Include="..\..\..\nfd\common.h" />
|
||||||
<ClInclude Include="..\..\..\nfd\nfd.h" />
|
<ClInclude Include="..\..\..\nfd\nfd.h" />
|
||||||
<ClInclude Include="..\..\..\nfd\nfd_common.h" />
|
<ClInclude Include="..\..\..\nfd\nfd_common.h" />
|
||||||
|
<ClInclude Include="..\..\..\server\TracyBadVersion.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyCharUtil.hpp" />
|
<ClInclude Include="..\..\..\server\TracyCharUtil.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyEvent.hpp" />
|
<ClInclude Include="..\..\..\server\TracyEvent.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp" />
|
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp" />
|
||||||
|
@ -63,6 +63,9 @@
|
|||||||
<ClCompile Include="..\..\..\nfd\nfd_win.cpp">
|
<ClCompile Include="..\..\..\nfd\nfd_win.cpp">
|
||||||
<Filter>nfd</Filter>
|
<Filter>nfd</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\server\TracyBadVersion.cpp">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
|
<ClInclude Include="..\..\..\common\tracy_lz4.hpp">
|
||||||
@ -170,6 +173,9 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp">
|
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp">
|
||||||
<Filter>server</Filter>
|
<Filter>server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\server\TracyBadVersion.hpp">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="DebugVis.natvis" />
|
<Natvis Include="DebugVis.natvis" />
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "../nfd/nfd.h"
|
#include "../nfd/nfd.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "../../server/TracyBadVersion.hpp"
|
||||||
#include "../../server/TracyFileRead.hpp"
|
#include "../../server/TracyFileRead.hpp"
|
||||||
#include "../../server/TracyView.hpp"
|
#include "../../server/TracyView.hpp"
|
||||||
|
|
||||||
@ -120,39 +121,7 @@ int main( int argc, char** argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( badVer != 0 )
|
tracy::BadVersion( badVer );
|
||||||
{
|
|
||||||
if( badVer > 0 )
|
|
||||||
{
|
|
||||||
ImGui::OpenPopup( "Unsupported file version" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::OpenPopup( "Bad file" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
|
||||||
{
|
|
||||||
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 >> 16, ( badVer >> 8 ) & 0xFF, badVer & 0xFF );
|
|
||||||
ImGui::Separator();
|
|
||||||
if( ImGui::Button( "I understand" ) )
|
|
||||||
{
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
badVer = 0;
|
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
if( ImGui::BeginPopupModal( "Bad file", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
|
||||||
{
|
|
||||||
ImGui::Text( "The file you are trying to open is not a tracy dump." );
|
|
||||||
ImGui::Separator();
|
|
||||||
if( ImGui::Button( "Oops" ) )
|
|
||||||
{
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
badVer = 0;
|
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user