Skip to content

Commit

Permalink
fix(sdk): don't instantiate resmon when there's no resource manager
Browse files Browse the repository at this point in the history
And ignore _cfx_internal for sdk
  • Loading branch information
nihonium-cfx committed Jun 20, 2023
1 parent b197237 commit 5dab7bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/components/citizen-devtools/src/ResourceTimeWarnings.cpp
Expand Up @@ -510,6 +510,11 @@ static InitFunction initFunction([]()
std::vector<std::tuple<std::string, double, double, int64_t, int64_t>> resourceDatasClean;
for (const auto& data : resourceDatas)
{
if (std::get<0>(data) == "_cfx_internal")
{
continue;
}

resourceDatasClean.push_back(tuple_slice<0, std::tuple_size_v<decltype(resourceDatasClean)::value_type>>(data));
}

Expand Down
10 changes: 10 additions & 0 deletions code/components/citizen-server-fxdk/src/SdkIpc.cpp
Expand Up @@ -754,6 +754,11 @@ namespace fxdk

m_timer->on<uvw::TimerEvent>([this, ipc](const uvw::TimerEvent& evt, uvw::TimerHandle&)
{
if (!fx::ResourceManager::GetCurrent())
{
return;
}

if (!m_resourceMonitor)
{
m_resourceMonitor = std::make_unique<fx::ResourceMonitor>();
Expand All @@ -764,6 +769,11 @@ namespace fxdk
std::vector<std::tuple<std::string, double, double, int64_t, int64_t>> resourceDatasClean;
for (const auto& data : resourceDatas)
{
if (std::get<0>(data) == "_cfx_internal")
{
continue;
}

resourceDatasClean.push_back(tuple_slice<0, std::tuple_size_v<decltype(resourceDatasClean)::value_type>>(data));
}

Expand Down

0 comments on commit 5dab7bc

Please sign in to comment.